style: hide empty favorites section
This commit is contained in:
@@ -10,12 +10,8 @@ export function FavoritesSection({ stations }: { stations: SynopStation[] }) {
|
||||
const { t } = useI18n();
|
||||
const favoriteIds = useWeatherStore((state) => state.favorites);
|
||||
const favorites = stations.filter((station) => favoriteIds.includes(station.id));
|
||||
if (!favorites.length) return (
|
||||
<section className="glass-subtle rounded-[1.75rem] p-5">
|
||||
<div className="flex items-center gap-2 text-sm font-semibold"><Heart className="size-4 text-rose-500" />{t("favorites.title")}</div>
|
||||
<p className="mt-2 text-sm text-slate-600 dark:text-slate-300">{t("favorites.empty")}</p>
|
||||
</section>
|
||||
);
|
||||
if (!favorites.length) return null;
|
||||
|
||||
return (
|
||||
<section className="space-y-3">
|
||||
<div className="flex items-center gap-2 text-sm font-semibold"><Heart className="size-4 fill-rose-500 text-rose-500" />{t("favorites.title")}</div>
|
||||
|
||||
@@ -54,7 +54,6 @@ const translations = {
|
||||
"featured.label": "Szybki wybór",
|
||||
"featured.title": "Wybrane stacje IMGW",
|
||||
"favorites.title": "Ulubione lokalizacje",
|
||||
"favorites.empty": "Dodaj stacje do ulubionych, aby mieć ich odczyty pod ręką.",
|
||||
"favorites.addStation": "Dodaj {name} do ulubionych",
|
||||
"favorites.removeStation": "Usuń {name} z ulubionych",
|
||||
"favorites.add": "Dodaj do ulubionych",
|
||||
@@ -216,7 +215,6 @@ const translations = {
|
||||
"featured.label": "Quick select",
|
||||
"featured.title": "Selected IMGW stations",
|
||||
"favorites.title": "Favourite locations",
|
||||
"favorites.empty": "Add stations to favourites to keep their readings close at hand.",
|
||||
"favorites.addStation": "Add {name} to favourites",
|
||||
"favorites.removeStation": "Remove {name} from favourites",
|
||||
"favorites.add": "Add to favourites",
|
||||
|
||||
Reference in New Issue
Block a user