diff --git a/README.md b/README.md index 9ef1f1d..dc654df 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,9 @@ We'd also like to thank the following partners for their generous support:
| + |
-
+
|
diff --git a/src/components/EmptyChat.tsx b/src/components/EmptyChat.tsx
index d9b6686..775fc9d 100644
--- a/src/components/EmptyChat.tsx
+++ b/src/components/EmptyChat.tsx
@@ -1,3 +1,6 @@
+'use client';
+
+import { useEffect, useState } from 'react';
import { Settings } from 'lucide-react';
import EmptyChatMessageInput from './EmptyChatMessageInput';
import { File } from './ChatWindow';
@@ -5,8 +8,39 @@ import Link from 'next/link';
import WeatherWidget from './WeatherWidget';
import NewsArticleWidget from './NewsArticleWidget';
import SettingsButtonMobile from '@/components/Settings/SettingsButtonMobile';
+import {
+ getShowNewsWidget,
+ getShowWeatherWidget,
+} from '@/lib/config/clientRegistry';
const EmptyChat = () => {
+ const [showWeather, setShowWeather] = useState(() =>
+ typeof window !== 'undefined' ? getShowWeatherWidget() : true,
+ );
+ const [showNews, setShowNews] = useState(() =>
+ typeof window !== 'undefined' ? getShowNewsWidget() : true,
+ );
+
+ useEffect(() => {
+ const updateWidgetVisibility = () => {
+ setShowWeather(getShowWeatherWidget());
+ setShowNews(getShowNewsWidget());
+ };
+
+ updateWidgetVisibility();
+
+ window.addEventListener('client-config-changed', updateWidgetVisibility);
+ window.addEventListener('storage', updateWidgetVisibility);
+
+ return () => {
+ window.removeEventListener(
+ 'client-config-changed',
+ updateWidgetVisibility,
+ );
+ window.removeEventListener('storage', updateWidgetVisibility);
+ };
+ }, []);
+
return (
@@ -19,14 +53,20 @@ const EmptyChat = () => {
-
-
-
+ )}
+ {showWeather && (
+
-
+
+ )}
+ {showNews && (
+
+
+ )}
-
- |