Skip to content

Commit 64a02ee

Browse files
committed
revamp the settings
1 parent 8cb8d3f commit 64a02ee

32 files changed

Lines changed: 737 additions & 432 deletions

src/App.tsx

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { useEffect, useLayoutEffect, useState } from 'react'
2-
import 'react-contexify/dist/ReactContexify.css'
3-
import 'src/assets/App.css'
4-
import { DNDLayout, Header } from 'src/components/Layout'
2+
import { DNDLayout } from 'src/components/Layout'
53
import { MarketingBanner } from 'src/features/MarketingBanner'
6-
import { BookmarksSidebar } from 'src/features/bookmarks'
74
import { setupAnalytics, setupIdentification, trackPageView } from 'src/lib/analytics'
85
import { useUserPreferences } from 'src/stores/preferences'
96
import { AppContentLayout } from './components/Layout'
@@ -22,8 +19,6 @@ const intersectionCallback = (entries: IntersectionObserverEntry[]) => {
2219
}
2320

2421
export const App = () => {
25-
const [showSideBar, setShowSideBar] = useState(false)
26-
const [showSettings, setShowSettings] = useState(false)
2722
const [showOnboarding, setShowOnboarding] = useState(true)
2823
const { onboardingCompleted, maxVisibleCards, isDNDModeActive, DNDDuration, setDNDDuration } =
2924
useUserPreferences()
@@ -65,23 +60,13 @@ export const App = () => {
6560
return (
6661
<>
6762
<MarketingBanner />
63+
{!onboardingCompleted && isWebOrExtensionVersion() === 'extension' && (
64+
<OnboardingModal showOnboarding={showOnboarding} setShowOnboarding={setShowOnboarding} />
65+
)}
6866

69-
<div className="App">
70-
{!onboardingCompleted && isWebOrExtensionVersion() === 'extension' && (
71-
<OnboardingModal showOnboarding={showOnboarding} setShowOnboarding={setShowOnboarding} />
72-
)}
73-
<Header
74-
setShowSideBar={setShowSideBar}
75-
showSideBar={showSideBar}
76-
showSettings={showSettings}
77-
setShowSettings={setShowSettings}
78-
/>
79-
80-
<div className="layoutLayers hideScrollBar">
81-
{isDNDModeActive() && <DNDLayout />}
82-
<AppContentLayout setShowSettings={setShowSettings} />
83-
</div>
84-
<BookmarksSidebar showSidebar={showSideBar} onClose={() => setShowSideBar(false)} />
67+
<div className="layoutLayers hideScrollBar">
68+
{isDNDModeActive() && <DNDLayout />}
69+
<AppContentLayout />
8570
</div>
8671
</>
8772
)

src/assets/App.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,10 @@ Producthunt item
976976
.blockHeader {
977977
display: none;
978978
}
979+
980+
.tags {
981+
display: none;
982+
}
979983
}
980984

981985
@keyframes cardPlaceholderPulse {

src/assets/variables.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ html.dark {
9494
--settings-input-border-focus-color: #6b7b90;
9595
--settings-input-placeholder-color: #42474e;
9696
--settings-input-text-color: #fff;
97+
98+
--horizontal-tabs-layout-active-color: white;
99+
--horizontal-tabs-layout-text-color: #798595;
97100
}
98101

99102
html.light {
@@ -176,4 +179,7 @@ html.light {
176179
--settings-input-border-focus-color: #c4d6df;
177180
--settings-input-placeholder-color: #97a6ad;
178181
--settings-input-text-color: #253b53;
182+
183+
--horizontal-tabs-layout-active-color: #0366d6;
184+
--horizontal-tabs-layout-text-color: #3c5065;
179185
}

src/components/Elements/BottomNavigation/BottomNavigation.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
import { AiOutlineMenu } from 'react-icons/ai'
22
import { BsRssFill } from 'react-icons/bs'
3+
import { useNavigate } from 'react-router-dom'
34
import { SUPPORTED_CARDS } from 'src/config/supportedCards'
45
import { useUserPreferences } from 'src/stores/preferences'
56
import { SelectedCard } from 'src/types'
67

78
type BottomNavigationProps = {
89
selectedCard: SelectedCard
910
setSelectedCard: (card: SelectedCard) => void
10-
setShowSettings: (value: boolean | ((prevVar: boolean) => boolean)) => void
1111
}
1212

13-
export const BottomNavigation = ({
14-
selectedCard,
15-
setSelectedCard,
16-
setShowSettings,
17-
}: BottomNavigationProps) => {
13+
export const BottomNavigation = ({ selectedCard, setSelectedCard }: BottomNavigationProps) => {
1814
const { cards, userCustomCards } = useUserPreferences()
1915
const AVAILABLE_CARDS = [...SUPPORTED_CARDS, ...userCustomCards]
16+
const navigate = useNavigate()
2017

2118
return (
2219
<div className="bottomNavigation">
@@ -40,7 +37,9 @@ export const BottomNavigation = ({
4037
<button
4138
aria-label="Open settings"
4239
className={'navigationItem '}
43-
onClick={() => setShowSettings((prev: boolean) => !prev)}>
40+
onClick={() => {
41+
navigate('/settings/general')
42+
}}>
4443
{<AiOutlineMenu />}
4544
</button>
4645
}
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { TiPlus } from 'react-icons/ti'
2+
import { Link } from 'react-router-dom'
23
import { useUserPreferences } from 'src/stores/preferences'
34

4-
type UserTagsProps = {
5-
onAddClicked: () => void
6-
}
7-
8-
export const UserTags = ({ onAddClicked }: UserTagsProps) => {
5+
export const UserTags = () => {
96
const { userSelectedTags } = useUserPreferences()
107

118
return (
@@ -15,9 +12,9 @@ export const UserTags = ({ onAddClicked }: UserTagsProps) => {
1512
{tag.value}
1613
</span>
1714
))}
18-
<button aria-label="Open settings" className="tag tagHoverable" onClick={onAddClicked}>
15+
<Link to="/settings/topics" className="tag tagHoverable" aria-label="Open settings">
1916
<TiPlus className="tagIcon" />
20-
</button>
17+
</Link>
2118
</div>
2219
)
2320
}

src/components/Layout/AppContentLayout.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ import { ScrollCardsNavigator } from './'
66
import { DesktopCards } from './DesktopCards'
77
import { MobileCards } from './MobileCards'
88

9-
export const AppContentLayout = ({
10-
setShowSettings,
11-
}: {
12-
setShowSettings: (value: boolean | ((prevVar: boolean) => boolean)) => void
13-
}) => {
9+
export const AppContentLayout = () => {
1410
const { cards, userCustomCards } = useUserPreferences()
1511
const [selectedCard, setSelectedCard] = useState(cards[0])
1612

@@ -26,11 +22,7 @@ export const AppContentLayout = ({
2622
</div>
2723
)}
2824
</main>
29-
<BottomNavigation
30-
selectedCard={selectedCard}
31-
setSelectedCard={setSelectedCard}
32-
setShowSettings={setShowSettings}
33-
/>
25+
<BottomNavigation selectedCard={selectedCard} setSelectedCard={setSelectedCard} />
3426
</>
3527
)
3628
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react'
2+
import 'react-contexify/dist/ReactContexify.css'
3+
import { Outlet } from 'react-router-dom'
4+
import { BeatLoader } from 'react-spinners'
5+
import 'src/assets/App.css'
6+
import { MarketingBanner } from 'src/features/MarketingBanner'
7+
import { Header } from './Header'
8+
9+
export const AppLayout = () => {
10+
return (
11+
<>
12+
<MarketingBanner />
13+
14+
<div className="App">
15+
<Header />
16+
<React.Suspense
17+
fallback={
18+
<div className="appLoading">
19+
<BeatLoader color={'#A9B2BD'} loading={true} size={15} />
20+
</div>
21+
}>
22+
<Outlet />
23+
</React.Suspense>
24+
</div>
25+
</>
26+
)
27+
}

src/components/Layout/Header.tsx

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,20 @@ import { BsFillBookmarksFill, BsFillGearFill, BsMoonFill } from 'react-icons/bs'
33
import { CgTab } from 'react-icons/cg'
44
import { IoMdSunny } from 'react-icons/io'
55
import { MdDoDisturbOff } from 'react-icons/md'
6+
import { Link, useNavigate } from 'react-router-dom'
67
import { ReactComponent as HackertabLogo } from 'src/assets/logo.svg'
78
import { SearchBar } from 'src/components/Elements/SearchBar'
89
import { UserTags } from 'src/components/Elements/UserTags'
910
import { Changelog } from 'src/features/changelog'
10-
import { SettingsModal } from 'src/features/settings'
1111
import { identifyUserTheme, trackDNDDisable, trackThemeSelect } from 'src/lib/analytics'
1212
import { useBookmarks } from 'src/stores/bookmarks'
1313
import { useUserPreferences } from 'src/stores/preferences'
1414

15-
type HeaderProps = {
16-
showSideBar: boolean
17-
setShowSideBar: (show: boolean) => void
18-
showSettings: boolean
19-
setShowSettings: (show: boolean) => void
20-
}
21-
22-
export const Header = ({
23-
showSideBar,
24-
setShowSideBar,
25-
showSettings,
26-
setShowSettings,
27-
}: HeaderProps) => {
15+
export const Header = () => {
2816
const [themeIcon, setThemeIcon] = useState(<BsMoonFill />)
2917
const { theme, setTheme, setDNDDuration, isDNDModeActive } = useUserPreferences()
3018
const { userBookmarks } = useBookmarks()
19+
const navigate = useNavigate()
3120

3221
useEffect(() => {
3322
document.documentElement.classList.add(theme)
@@ -52,7 +41,7 @@ export const Header = ({
5241
}
5342

5443
const onSettingsClick = () => {
55-
setShowSettings(true)
44+
navigate('/settings/general')
5645
}
5746

5847
const BookmarksBadgeCount = () => {
@@ -72,14 +61,14 @@ export const Header = ({
7261

7362
return (
7463
<>
75-
<SettingsModal showSettings={showSettings} setShowSettings={setShowSettings} />
76-
7764
<header className="AppHeader">
7865
<span className="AppName">
7966
<i className="logo">
8067
<CgTab />
8168
</i>{' '}
82-
<HackertabLogo aria-label="hackertab.dev" className="logoText" />
69+
<Link to="/">
70+
<HackertabLogo aria-label="hackertab.dev" className="logoText" />
71+
</Link>
8372
<Changelog />
8473
</span>
8574
<SearchBar />
@@ -99,15 +88,14 @@ export const Header = ({
9988
onClick={onThemeChange}>
10089
{themeIcon}
10190
</button>
102-
<button
103-
aria-label="Open bookmarks"
104-
className="extraBtn"
105-
onClick={() => setShowSideBar(!showSideBar)}>
106-
<BsFillBookmarksFill />
107-
<BookmarksBadgeCount />
108-
</button>
91+
<Link to="/settings/bookmarks" className="extraBtn" aria-label="Open bookmarks">
92+
<>
93+
<BsFillBookmarksFill />
94+
<BookmarksBadgeCount />
95+
</>
96+
</Link>
10997
</div>
110-
<UserTags onAddClicked={onSettingsClick} />
98+
<UserTags />
11199
</header>
112100
</>
113101
)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import './settingsContentLayout.css'
2+
3+
type SettingsContentLayoutProps = {
4+
title: string
5+
description: string
6+
children: React.ReactNode
7+
}
8+
9+
export const SettingsContentLayout = ({
10+
title,
11+
description,
12+
children,
13+
}: SettingsContentLayoutProps) => {
14+
return (
15+
<div className="settingsContent">
16+
<header>
17+
<h1 className="title">{title}</h1>
18+
<p className="description">{description}</p>
19+
</header>
20+
<main className="settingsBody scrollable">{children}</main>
21+
</div>
22+
)
23+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './SettingsContentLayout'

0 commit comments

Comments
 (0)