style: hide empty favorites section

This commit is contained in:
zv
2026-06-02 15:49:20 +02:00
parent fa8ca75dcd
commit 7b8c26d8f1
2 changed files with 2 additions and 8 deletions

View File

@@ -10,12 +10,8 @@ export function FavoritesSection({ stations }: { stations: SynopStation[] }) {
const { t } = useI18n(); const { t } = useI18n();
const favoriteIds = useWeatherStore((state) => state.favorites); const favoriteIds = useWeatherStore((state) => state.favorites);
const favorites = stations.filter((station) => favoriteIds.includes(station.id)); const favorites = stations.filter((station) => favoriteIds.includes(station.id));
if (!favorites.length) return ( if (!favorites.length) return null;
<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>
);
return ( return (
<section className="space-y-3"> <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> <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>

View File

@@ -54,7 +54,6 @@ const translations = {
"featured.label": "Szybki wybór", "featured.label": "Szybki wybór",
"featured.title": "Wybrane stacje IMGW", "featured.title": "Wybrane stacje IMGW",
"favorites.title": "Ulubione lokalizacje", "favorites.title": "Ulubione lokalizacje",
"favorites.empty": "Dodaj stacje do ulubionych, aby mieć ich odczyty pod ręką.",
"favorites.addStation": "Dodaj {name} do ulubionych", "favorites.addStation": "Dodaj {name} do ulubionych",
"favorites.removeStation": "Usuń {name} z ulubionych", "favorites.removeStation": "Usuń {name} z ulubionych",
"favorites.add": "Dodaj do ulubionych", "favorites.add": "Dodaj do ulubionych",
@@ -216,7 +215,6 @@ const translations = {
"featured.label": "Quick select", "featured.label": "Quick select",
"featured.title": "Selected IMGW stations", "featured.title": "Selected IMGW stations",
"favorites.title": "Favourite locations", "favorites.title": "Favourite locations",
"favorites.empty": "Add stations to favourites to keep their readings close at hand.",
"favorites.addStation": "Add {name} to favourites", "favorites.addStation": "Add {name} to favourites",
"favorites.removeStation": "Remove {name} from favourites", "favorites.removeStation": "Remove {name} from favourites",
"favorites.add": "Add to favourites", "favorites.add": "Add to favourites",