Skip to content

Commit

Permalink
store logo and its aspect ratio in kubernetes
Browse files Browse the repository at this point in the history
  • Loading branch information
theosanderson authored Feb 21, 2024
1 parent 6a58697 commit 324ad2c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions kubernetes/loculus/templates/_common-metadata.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fields:
{{/* Generate website config from passed config object */}}
{{- define "loculus.generateWebsiteConfig" }}
name: {{ $.Values.name }}
logo: {{ $.Values.logo | toYaml | nindent 6 }}
accessionPrefix: {{ $.Values.accessionPrefix }}
{{- $commonMetadata := (include "loculus.commonMetadata" . | fromYaml).fields }}
instances:
Expand Down
4 changes: 4 additions & 0 deletions kubernetes/loculus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ disablePreprocessing: false
siloImportLimitSeconds: 3600
accessionPrefix: "LOC_"
name: "Loculus"
logo:
url: "/favicon.svg"
width: 100
height: 100
instances:
dummy-organism:
schema:
Expand Down
2 changes: 1 addition & 1 deletion website/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function getConfigDir(): string {
return configDir;
}

function getWebsiteConfig(): WebsiteConfig {
export function getWebsiteConfig(): WebsiteConfig {
if (_config === null) {
_config = readTypedConfigFile('website_config.json', websiteConfig);
}
Expand Down
14 changes: 13 additions & 1 deletion website/src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
import '../styles/base.scss';
import Navigation from '../components/Navigation/Navigation.astro';
import OrganismSelector from '../components/Navigation/OrganismSelector.astro';
import { getWebsiteConfig } from '../config';
import { navigationItems } from '../routes';
const websiteConfig = getWebsiteConfig();
const logo = websiteConfig.logo;
interface Props {
title: string;
Expand All @@ -27,7 +30,16 @@ const { title } = Astro.props;
<div class='flex justify-start'>
<div class='flex flex-col'>
<div class='flex flex-row pb-3'>
<a href='/'><img class='h-8 mr-4' src='/favicon.svg' alt='icon' /></a>
<a href='/'
><img
class='h-8 mr-4'
src={logo.url}
alt='icon'
style={{
aspectRatio: `${logo.width}/${logo.height}`,
}}
/></a
>
<a href='/' class='fancytitle mr-4'>Loculus</a>
</div>
<OrganismSelector />
Expand Down
15 changes: 15 additions & 0 deletions website/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ export type MetadataFilter = Metadata & {
label?: string;
};

export type LogoConfig = {
url: string;
width: number;
height: number;
};

export type FilterValue = Pick<MetadataFilter, 'name' | 'filterValue'>;

export type MutationFilter = {
Expand All @@ -33,6 +39,13 @@ const schema = z.object({
defaultOrderBy: z.string(),
defaultOrder: orderByType,
});

const logoConfig = z.object({
url: z.string(),
width: z.number(),
height: z.number(),
});

export type Schema = z.infer<typeof schema>;

export const instanceConfig = z.object({
Expand All @@ -43,5 +56,7 @@ export type InstanceConfig = z.infer<typeof instanceConfig>;

export const websiteConfig = z.object({
instances: z.record(instanceConfig),
logo: logoConfig,
});

export type WebsiteConfig = z.infer<typeof websiteConfig>;

0 comments on commit 324ad2c

Please sign in to comment.