feat(settings): add weather and news widget toggles in settings page
This commit is contained in:
parent
0d4874a3b3
commit
c830273651
4 changed files with 116 additions and 11 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { Settings } from 'lucide-react';
|
||||
import { useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { File } from './ChatWindow';
|
||||
import Link from 'next/link';
|
||||
import MessageInput from './MessageInput';
|
||||
|
|
@ -31,6 +31,13 @@ const EmptyChat = ({
|
|||
files: File[];
|
||||
setFiles: (files: File[]) => void;
|
||||
}) => {
|
||||
const [showWeatherWidget, setShowWeatherWidget] = useState(true);
|
||||
const [showNewsWidget, setShowNewsWidget] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
setShowWeatherWidget(localStorage.getItem('showWeatherWidget') !== 'false');
|
||||
setShowNewsWidget(localStorage.getItem('showNewsWidget') !== 'false');
|
||||
}, []);
|
||||
return (
|
||||
<div className="relative">
|
||||
<div className="absolute w-full flex flex-row items-center justify-end mr-5 mt-5">
|
||||
|
|
@ -40,7 +47,7 @@ const EmptyChat = ({
|
|||
</div>
|
||||
<div className="flex flex-col items-center justify-center min-h-screen max-w-screen-sm mx-auto p-2 space-y-4">
|
||||
<div className="flex flex-col items-center justify-center w-full space-y-8">
|
||||
<h2 className="text-3xl font-medium -mt-8">Research begins here.</h2>
|
||||
{/* <h2 className="text-3xl font-medium -mt-8">Research begins here.</h2> */}
|
||||
<MessageInput
|
||||
firstMessage={true}
|
||||
loading={false}
|
||||
|
|
@ -58,12 +65,16 @@ const EmptyChat = ({
|
|||
/>
|
||||
</div>
|
||||
<div className="flex flex-col w-full gap-4 mt-2 sm:flex-row sm:justify-center">
|
||||
<div className="flex-1 w-full">
|
||||
<WeatherWidget />
|
||||
</div>
|
||||
<div className="flex-1 w-full">
|
||||
<NewsArticleWidget />
|
||||
</div>
|
||||
{showWeatherWidget && (
|
||||
<div className="flex-1 w-full">
|
||||
<WeatherWidget />
|
||||
</div>
|
||||
)}
|
||||
{showNewsWidget && (
|
||||
<div className="flex-1 w-full">
|
||||
<NewsArticleWidget />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue