Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
4d54463a
Commit
4d54463a
authored
Dec 18, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add mobile header
parent
40bc8df6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
130 additions
and
194 deletions
+130
-194
FloatingNavButton.tsx
web/src/components/FloatingNavButton.tsx
+0
-53
Archived.tsx
web/src/pages/Archived.tsx
+3
-9
Home.tsx
web/src/pages/Home.tsx
+1
-0
MemoDetail.tsx
web/src/pages/MemoDetail.tsx
+103
-106
UserProfile.tsx
web/src/pages/UserProfile.tsx
+23
-26
No files found.
web/src/components/FloatingNavButton.tsx
deleted
100644 → 0
View file @
40bc8df6
import
{
Dropdown
,
IconButton
,
Menu
,
MenuButton
}
from
"@mui/joy"
;
import
{
useEffect
}
from
"react"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
Icon
from
"./Icon"
;
const
FloatingNavButton
=
()
=>
{
const
t
=
useTranslate
();
const
navigateTo
=
useNavigateTo
();
useEffect
(()
=>
{
handleScrollToTop
();
},
[]);
const
handleScrollToTop
=
()
=>
{
document
.
body
.
querySelector
(
"#root"
)?.
scrollTo
({
top
:
0
,
behavior
:
"smooth"
});
};
return
(
<>
<
Dropdown
>
<
div
className=
"fixed bottom-6 right-6"
>
<
MenuButton
slots=
{
{
root
:
IconButton
}
}
slotProps=
{
{
root
:
{
className
:
"!bg-white dark:!bg-zinc-900 drop-shadow"
,
size
:
"sm"
,
variant
:
"outlined"
,
color
:
"neutral"
},
}
}
>
<
Icon
.
MoreVertical
className=
"w-4 h-auto"
/>
</
MenuButton
>
</
div
>
<
Menu
placement=
"top-end"
>
<
button
className=
"w-full text-left text-sm flex flex-row justify-start items-center whitespace-nowrap leading-6 py-1 px-3 cursor-pointer hover:bg-gray-100 dark:hover:bg-zinc-600"
onClick=
{
handleScrollToTop
}
>
<
Icon
.
ArrowUpToLine
className=
"w-4 h-auto mr-1 opacity-70"
/>
{
t
(
"router.back-to-top"
)
}
</
button
>
<
button
className=
"w-full text-left text-sm flex flex-row justify-start items-center whitespace-nowrap leading-6 py-1 px-3 cursor-pointer hover:bg-gray-100 dark:hover:bg-zinc-600"
onClick=
{
()
=>
navigateTo
(
"/"
)
}
>
<
Icon
.
Home
className=
"w-4 h-auto mr-1 opacity-70"
/>
{
t
(
"router.go-to-home"
)
}
</
button
>
</
Menu
>
</
Dropdown
>
</>
);
};
export
default
FloatingNavButton
;
web/src/pages/Archived.tsx
View file @
4d54463a
...
@@ -2,10 +2,9 @@ import { useEffect, useState } from "react";
...
@@ -2,10 +2,9 @@ import { useEffect, useState } from "react";
import
toast
from
"react-hot-toast"
;
import
toast
from
"react-hot-toast"
;
import
ArchivedMemo
from
"@/components/ArchivedMemo"
;
import
ArchivedMemo
from
"@/components/ArchivedMemo"
;
import
Empty
from
"@/components/Empty"
;
import
Empty
from
"@/components/Empty"
;
import
MemoFilter
from
"@/components/MemoFilter"
;
import
MobileHeader
from
"@/components/MobileHeader"
;
import
MobileHeader
from
"@/components/MobileHeader"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
{
use
FilterStore
,
use
MemoStore
}
from
"@/store/module"
;
import
{
useMemoStore
}
from
"@/store/module"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
const
Archived
=
()
=>
{
const
Archived
=
()
=>
{
...
@@ -14,16 +13,12 @@ const Archived = () => {
...
@@ -14,16 +13,12 @@ const Archived = () => {
const
loadingState
=
useLoading
();
const
loadingState
=
useLoading
();
const
[
archivedMemos
,
setArchivedMemos
]
=
useState
<
Memo
[]
>
([]);
const
[
archivedMemos
,
setArchivedMemos
]
=
useState
<
Memo
[]
>
([]);
const
memos
=
memoStore
.
state
.
memos
;
const
memos
=
memoStore
.
state
.
memos
;
const
filterStore
=
useFilterStore
();
const
filter
=
filterStore
.
state
;
const
{
text
:
textQuery
}
=
filter
;
useEffect
(()
=>
{
useEffect
(()
=>
{
memoStore
memoStore
.
fetchArchivedMemos
()
.
fetchArchivedMemos
()
.
then
((
result
)
=>
{
.
then
((
result
)
=>
{
const
filteredMemos
=
textQuery
?
result
.
filter
((
memo
)
=>
memo
.
content
.
toLowerCase
().
includes
(
textQuery
.
toLowerCase
()))
:
result
;
setArchivedMemos
(
result
);
setArchivedMemos
(
filteredMemos
);
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
console
.
error
(
error
);
console
.
error
(
error
);
...
@@ -32,12 +27,11 @@ const Archived = () => {
...
@@ -32,12 +27,11 @@ const Archived = () => {
.
finally
(()
=>
{
.
finally
(()
=>
{
loadingState
.
setFinish
();
loadingState
.
setFinish
();
});
});
},
[
memos
,
textQuery
]);
},
[
memos
]);
return
(
return
(
<
section
className=
"@container w-full max-w-3xl min-h-full flex flex-col justify-start items-start px-4 sm:px-2 sm:pt-4 pb-8"
>
<
section
className=
"@container w-full max-w-3xl min-h-full flex flex-col justify-start items-start px-4 sm:px-2 sm:pt-4 pb-8"
>
<
MobileHeader
/>
<
MobileHeader
/>
<
MemoFilter
/>
{
loadingState
.
isLoading
?
(
{
loadingState
.
isLoading
?
(
<
div
className=
"w-full h-32 flex flex-col justify-center items-center"
>
<
div
className=
"w-full h-32 flex flex-col justify-center items-center"
>
<
p
className=
"opacity-70"
>
{
t
(
"memo.fetching-data"
)
}
</
p
>
<
p
className=
"opacity-70"
>
{
t
(
"memo.fetching-data"
)
}
</
p
>
...
...
web/src/pages/Home.tsx
View file @
4d54463a
...
@@ -7,6 +7,7 @@ import useResponsiveWidth from "@/hooks/useResponsiveWidth";
...
@@ -7,6 +7,7 @@ import useResponsiveWidth from "@/hooks/useResponsiveWidth";
const
Home
=
()
=>
{
const
Home
=
()
=>
{
const
{
md
}
=
useResponsiveWidth
();
const
{
md
}
=
useResponsiveWidth
();
return
(
return
(
<
div
className=
"w-full flex flex-row justify-center items-start"
>
<
div
className=
"w-full flex flex-row justify-center items-start"
>
<
div
className=
"w-full px-4 max-w-3xl sm:px-2 sm:pt-4"
>
<
div
className=
"w-full px-4 max-w-3xl sm:px-2 sm:pt-4"
>
...
...
web/src/pages/MemoDetail.tsx
View file @
4d54463a
...
@@ -3,7 +3,6 @@ import copy from "copy-to-clipboard";
...
@@ -3,7 +3,6 @@ import copy from "copy-to-clipboard";
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
Link
,
useParams
}
from
"react-router-dom"
;
import
{
Link
,
useParams
}
from
"react-router-dom"
;
import
FloatingNavButton
from
"@/components/FloatingNavButton"
;
import
Icon
from
"@/components/Icon"
;
import
Icon
from
"@/components/Icon"
;
import
Memo
from
"@/components/Memo"
;
import
Memo
from
"@/components/Memo"
;
import
MemoContentV1
from
"@/components/MemoContentV1"
;
import
MemoContentV1
from
"@/components/MemoContentV1"
;
...
@@ -11,6 +10,7 @@ import MemoEditor from "@/components/MemoEditor";
...
@@ -11,6 +10,7 @@ import MemoEditor from "@/components/MemoEditor";
import
showMemoEditorDialog
from
"@/components/MemoEditor/MemoEditorDialog"
;
import
showMemoEditorDialog
from
"@/components/MemoEditor/MemoEditorDialog"
;
import
MemoRelationListView
from
"@/components/MemoRelationListView"
;
import
MemoRelationListView
from
"@/components/MemoRelationListView"
;
import
MemoResourceListView
from
"@/components/MemoResourceListView"
;
import
MemoResourceListView
from
"@/components/MemoResourceListView"
;
import
MobileHeader
from
"@/components/MobileHeader"
;
import
showShareMemoDialog
from
"@/components/ShareMemoDialog"
;
import
showShareMemoDialog
from
"@/components/ShareMemoDialog"
;
import
UserAvatar
from
"@/components/UserAvatar"
;
import
UserAvatar
from
"@/components/UserAvatar"
;
import
VisibilityIcon
from
"@/components/VisibilityIcon"
;
import
VisibilityIcon
from
"@/components/VisibilityIcon"
;
...
@@ -110,8 +110,8 @@ const MemoDetail = () => {
...
@@ -110,8 +110,8 @@ const MemoDetail = () => {
};
};
return
(
return
(
<>
<
section
className=
"@container w-full max-w-3xl min-h-full flex flex-col justify-start items-center px-4 sm:px-2 sm:pt-4 pb-8"
>
<
section
className=
"@container w-full max-w-3xl min-h-full flex flex-col justify-start items-center px-4 sm:px-2 sm:pt-4 pb-8"
>
<
MobileHeader
/>
<
div
className=
"relative flex-grow w-full min-h-full flex flex-col justify-start items-start border dark:border-zinc-700 bg-white dark:bg-zinc-700 shadow hover:shadow-xl transition-all p-4 pb-3 rounded-lg"
>
<
div
className=
"relative flex-grow w-full min-h-full flex flex-col justify-start items-start border dark:border-zinc-700 bg-white dark:bg-zinc-700 shadow hover:shadow-xl transition-all p-4 pb-3 rounded-lg"
>
{
memo
.
parent
&&
(
{
memo
.
parent
&&
(
<
div
className=
"w-auto mb-2"
>
<
div
className=
"w-auto mb-2"
>
...
@@ -221,9 +221,6 @@ const MemoDetail = () => {
...
@@ -221,9 +221,6 @@ const MemoDetail = () => {
</
div
>
</
div
>
</
div
>
</
div
>
</
section
>
</
section
>
<
FloatingNavButton
/>
</>
);
);
};
};
...
...
web/src/pages/UserProfile.tsx
View file @
4d54463a
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
useParams
}
from
"react-router-dom"
;
import
{
useParams
}
from
"react-router-dom"
;
import
FloatingNavButton
from
"@/components/FloatingNavButton"
;
import
MemoList
from
"@/components/MemoList"
;
import
MemoList
from
"@/components/MemoList"
;
import
MobileHeader
from
"@/components/MobileHeader"
;
import
UserAvatar
from
"@/components/UserAvatar"
;
import
UserAvatar
from
"@/components/UserAvatar"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
{
useUserV1Store
}
from
"@/store/v1"
;
import
{
useUserV1Store
}
from
"@/store/v1"
;
...
@@ -35,8 +35,8 @@ const UserProfile = () => {
...
@@ -35,8 +35,8 @@ const UserProfile = () => {
},
[
params
.
username
]);
},
[
params
.
username
]);
return
(
return
(
<>
<
section
className=
"relative top-0 w-full min-h-full overflow-x-hidden"
>
<
section
className=
"relative top-0 w-full min-h-full overflow-x-hidden"
>
<
MobileHeader
/>
<
div
className=
"relative w-full min-h-full mx-auto flex flex-col justify-start items-center"
>
<
div
className=
"relative w-full min-h-full mx-auto flex flex-col justify-start items-center"
>
{
!
loadingState
.
isLoading
&&
{
!
loadingState
.
isLoading
&&
(
user
?
(
(
user
?
(
...
@@ -60,9 +60,6 @@ const UserProfile = () => {
...
@@ -60,9 +60,6 @@ const UserProfile = () => {
))
}
))
}
</
div
>
</
div
>
</
section
>
</
section
>
<
FloatingNavButton
/>
</>
);
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment