small
This commit is contained in:
@@ -24,13 +24,25 @@
|
||||
groups.flatMap((group) => group.models).find((mo) => mo.value === selectedModel)
|
||||
);
|
||||
let modelLabel = $derived(model?.label ?? selectedModel);
|
||||
// The catalogue stores update cadences as English shorthand ("every 6 h");
|
||||
// map the handful of forms onto messages instead of translating the data.
|
||||
function updateLabel(update: string): string {
|
||||
const hours = update.match(/^every (\d+) h$/);
|
||||
if (hours) return m.model_updated({ cadence: m.cadence_every_hours({ hours: hours[1] }) });
|
||||
const named: Record<string, () => string> = {
|
||||
'every hour': m.cadence_every_hour,
|
||||
daily: m.cadence_daily,
|
||||
monthly: m.cadence_monthly,
|
||||
varies: m.cadence_varies
|
||||
};
|
||||
return m.model_updated({ cadence: (named[update] ?? (() => update))() });
|
||||
}
|
||||
|
||||
let modelMeta = $derived.by(() => {
|
||||
if (model?.resolution && model.resolution !== 'varies') {
|
||||
return model.update ? `${model.resolution} · updated ${model.update}` : model.resolution;
|
||||
return model.update ? `${model.resolution} · ${updateLabel(model.update)}` : model.resolution;
|
||||
}
|
||||
return selectedModel === 'best_match'
|
||||
? 'Automatically picks the best model for this location'
|
||||
: '';
|
||||
return selectedModel === 'best_match' ? m.model_best_match_hint() : '';
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -96,7 +108,7 @@
|
||||
<span class="font-medium">{mo.label}</span>
|
||||
{#if mo.resolution && mo.resolution !== 'varies'}
|
||||
<span class="text-[11px] text-muted-foreground">
|
||||
{mo.resolution}{mo.update ? ` · updated ${mo.update}` : ''}
|
||||
{mo.resolution}{mo.update ? ` · ${updateLabel(mo.update)}` : ''}
|
||||
</span>
|
||||
{:else if mo.value === 'best_match'}
|
||||
<span class="text-[11px] text-muted-foreground"
|
||||
|
||||
Reference in New Issue
Block a user