@@ -83,7 +87,6 @@ const ListItem: React.FC = ({ label, href, count, isActive }) =>
)}
>
diff --git a/web/components/custom/sidebar/partial/page-section.tsx b/web/components/custom/sidebar/partial/page-section.tsx
index b5064c0f..d8213c05 100644
--- a/web/components/custom/sidebar/partial/page-section.tsx
+++ b/web/components/custom/sidebar/partial/page-section.tsx
@@ -46,20 +46,32 @@ const SHOWS: Option[] = [
const pageSortAtom = atomWithStorage("pageSort", "title")
const pageShowAtom = atomWithStorage("pageShow", 5)
-export const PageSection: React.FC = () => {
- const { me } = useAccount({ root: { personalPages: [] } })
+export const PageSection: React.FC<{ pathname?: string }> = ({ pathname }) => {
+ const { me } = useAccount({
+ root: {
+ personalPages: []
+ }
+ })
+
+ const [sort, setSort] = useAtom(pageSortAtom)
+ const [show, setShow] = useAtom(pageShowAtom)
+
const pageCount = me?.root.personalPages?.length || 0
+ const isActive = pathname ? pathname.startsWith("/pages") : false
+
+ if (!me) return null
return (
-
- {me?.root.personalPages &&
}
+
+
)
}
interface PageSectionHeaderProps {
pageCount: number
+ isActive: boolean
}
const PageSectionHeader: React.FC = ({ pageCount }) => (
@@ -121,6 +133,8 @@ const NewPageButton: React.FC = () => {
interface PageListProps {
personalPages: PersonalPageLists
+ sort: SortOption
+ show: ShowOption
}
const PageList: React.FC = ({ personalPages }) => {
@@ -250,4 +264,4 @@ const ShowAllForm: React.FC = () => {
)
-}
\ No newline at end of file
+}
diff --git a/web/components/custom/sidebar/partial/topic-section.tsx b/web/components/custom/sidebar/partial/topic-section.tsx
index e1aaeb9b..0a2300b8 100644
--- a/web/components/custom/sidebar/partial/topic-section.tsx
+++ b/web/components/custom/sidebar/partial/topic-section.tsx
@@ -8,7 +8,7 @@ import { LaIcon } from "@/components/custom/la-icon"
import { ListOfTopics } from "@/lib/schema"
import { LEARNING_STATES, LearningStateValue } from "@/lib/constants"
-export const TopicSection: React.FC = () => {
+export const TopicSection: React.FC<{ pathname: string }> = ({ pathname }) => {
const { me } = useAccount({
root: {
topicsWantToLearn: [],
@@ -22,11 +22,13 @@ export const TopicSection: React.FC = () => {
(me?.root.topicsLearning?.length || 0) +
(me?.root.topicsLearned?.length || 0)
+ const isActive = pathname.startsWith("/topics")
+
if (!me) return null
return (
-
+
{
interface TopicSectionHeaderProps {
topicCount: number
+ isActive: boolean
}
-const TopicSectionHeader: React.FC = ({ topicCount }) => (
+const TopicSectionHeader: React.FC = ({ topicCount, isActive }) => (
)
-}
\ No newline at end of file
+}
diff --git a/web/components/custom/sidebar/sidebar.tsx b/web/components/custom/sidebar/sidebar.tsx
index 893dcebb..f05afe08 100644
--- a/web/components/custom/sidebar/sidebar.tsx
+++ b/web/components/custom/sidebar/sidebar.tsx
@@ -109,6 +109,7 @@ const LogoAndSearch: React.FC = React.memo(() => {
LogoAndSearch.displayName = "LogoAndSearch"
const SidebarContent: React.FC = React.memo(() => {
+ const pathname = usePathname()
return (
<>