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>
|
||||
|
||||
Reference in New Issue
Block a user