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
d8aeec99
Commit
d8aeec99
authored
Apr 27, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: replace classnames with clsx
parent
1b291422
Changes
33
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
145 additions
and
171 deletions
+145
-171
package.json
web/package.json
+2
-2
pnpm-lock.yaml
web/pnpm-lock.yaml
+58
-71
ActivityCalendar.tsx
web/src/components/ActivityCalendar.tsx
+4
-4
BaseDialog.tsx
web/src/components/Dialog/BaseDialog.tsx
+3
-3
ExploreSidebar.tsx
web/src/components/ExploreSidebar/ExploreSidebar.tsx
+2
-2
HomeSidebar.tsx
web/src/components/HomeSidebar/HomeSidebar.tsx
+2
-2
MemoCommentMessage.tsx
web/src/components/Inbox/MemoCommentMessage.tsx
+3
-3
VersionUpdateMessage.tsx
web/src/components/Inbox/VersionUpdateMessage.tsx
+3
-3
MemoActionMenu.tsx
web/src/components/MemoActionMenu.tsx
+2
-2
CodeBlock.tsx
web/src/components/MemoContent/CodeBlock.tsx
+3
-5
EmbeddedResource.tsx
...mponents/MemoContent/EmbeddedContent/EmbeddedResource.tsx
+2
-2
Spoiler.tsx
web/src/components/MemoContent/Spoiler.tsx
+3
-3
Tag.tsx
web/src/components/MemoContent/Tag.tsx
+2
-2
TaskList.tsx
web/src/components/MemoContent/TaskList.tsx
+2
-2
index.tsx
web/src/components/MemoContent/index.tsx
+2
-2
TagSuggestions.tsx
web/src/components/MemoEditor/Editor/TagSuggestions.tsx
+2
-2
index.tsx
web/src/components/MemoEditor/Editor/index.tsx
+2
-2
MemoFilter.tsx
web/src/components/MemoFilter.tsx
+2
-2
MemoView.tsx
web/src/components/MemoView.tsx
+3
-3
MobileHeader.tsx
web/src/components/MobileHeader.tsx
+2
-2
Navigation.tsx
web/src/components/Navigation.tsx
+3
-6
ReactionSelector.tsx
web/src/components/ReactionSelector.tsx
+3
-6
ReactionView.tsx
web/src/components/ReactionView.tsx
+2
-2
ResourceIcon.tsx
web/src/components/ResourceIcon.tsx
+4
-4
TimelineSidebar.tsx
web/src/components/TimelineSidebar/TimelineSidebar.tsx
+2
-2
UserAvatar.tsx
web/src/components/UserAvatar.tsx
+2
-2
UserBanner.tsx
web/src/components/UserBanner.tsx
+2
-2
VisibilityIcon.tsx
web/src/components/VisibilityIcon.tsx
+2
-2
OverflowTip.tsx
web/src/components/kit/OverflowTip.tsx
+2
-2
HomeLayout.tsx
web/src/layouts/HomeLayout.tsx
+5
-10
Explore.tsx
web/src/pages/Explore.tsx
+3
-3
Home.tsx
web/src/pages/Home.tsx
+3
-3
Timeline.tsx
web/src/pages/Timeline.tsx
+8
-8
No files found.
web/package.json
View file @
d8aeec99
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
"@matejmazur/react-katex"
:
"^3.1.3"
,
"@matejmazur/react-katex"
:
"^3.1.3"
,
"@mui/joy"
:
"5.0.0-beta.32"
,
"@mui/joy"
:
"5.0.0-beta.32"
,
"@reduxjs/toolkit"
:
"^2.2.3"
,
"@reduxjs/toolkit"
:
"^2.2.3"
,
"cl
assnames"
:
"^2.5
.1"
,
"cl
sx"
:
"^2.1
.1"
,
"copy-to-clipboard"
:
"^3.3.3"
,
"copy-to-clipboard"
:
"^3.3.3"
,
"fuse.js"
:
"^7.0.0"
,
"fuse.js"
:
"^7.0.0"
,
"highlight.js"
:
"^11.9.0"
,
"highlight.js"
:
"^11.9.0"
,
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
"@types/textarea-caret"
:
"^3.0.3"
,
"@types/textarea-caret"
:
"^3.0.3"
,
"@types/uuid"
:
"^9.0.8"
,
"@types/uuid"
:
"^9.0.8"
,
"@typescript-eslint/eslint-plugin"
:
"^7.7.0"
,
"@typescript-eslint/eslint-plugin"
:
"^7.7.0"
,
"@typescript-eslint/parser"
:
"^
6.21
.0"
,
"@typescript-eslint/parser"
:
"^
7.0
.0"
,
"@vitejs/plugin-react"
:
"^4.2.1"
,
"@vitejs/plugin-react"
:
"^4.2.1"
,
"autoprefixer"
:
"^10.4.19"
,
"autoprefixer"
:
"^10.4.19"
,
"eslint"
:
"^8.57.0"
,
"eslint"
:
"^8.57.0"
,
...
...
web/pnpm-lock.yaml
View file @
d8aeec99
This diff is collapsed.
Click to expand it.
web/src/components/ActivityCalendar.tsx
View file @
d8aeec99
import
{
Tooltip
}
from
"@mui/joy"
;
import
{
Tooltip
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
getNormalizedDateString
,
getDateWithOffset
}
from
"@/helpers/datetime"
;
import
{
getNormalizedDateString
,
getDateWithOffset
}
from
"@/helpers/datetime"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
...
@@ -47,7 +47,7 @@ const ActivityCalendar = (props: Props) => {
...
@@ -47,7 +47,7 @@ const ActivityCalendar = (props: Props) => {
}
}
return
(
return
(
<
div
className=
{
cl
assNames
(
"w-36 h-auto p-0.5 shrink-0 grid grid-cols-7 grid-flow-row gap-1"
)
}
>
<
div
className=
{
cl
sx
(
"w-36 h-auto p-0.5 shrink-0 grid grid-cols-7 grid-flow-row gap-1"
)
}
>
{
days
.
map
((
day
,
index
)
=>
{
{
days
.
map
((
day
,
index
)
=>
{
const
date
=
getNormalizedDateString
(
const
date
=
getNormalizedDateString
(
getDateWithOffset
(
`${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`
),
getDateWithOffset
(
`${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`
),
...
@@ -58,7 +58,7 @@ const ActivityCalendar = (props: Props) => {
...
@@ -58,7 +58,7 @@ const ActivityCalendar = (props: Props) => {
return
day
?
(
return
day
?
(
<
Tooltip
className=
"shrink-0"
key=
{
`${date}-${index}`
}
title=
{
tooltipText
}
placement=
"top"
arrow
>
<
Tooltip
className=
"shrink-0"
key=
{
`${date}-${index}`
}
title=
{
tooltipText
}
placement=
"top"
arrow
>
<
div
<
div
className=
{
cl
assNames
(
className=
{
cl
sx
(
"w-4 h-4 text-[9px] rounded-md flex justify-center items-center border border-transparent"
,
"w-4 h-4 text-[9px] rounded-md flex justify-center items-center border border-transparent"
,
getCellAdditionalStyles
(
count
,
maxCount
),
getCellAdditionalStyles
(
count
,
maxCount
),
isToday
&&
"border-gray-600 dark:!border-gray-500"
,
isToday
&&
"border-gray-600 dark:!border-gray-500"
,
...
@@ -71,7 +71,7 @@ const ActivityCalendar = (props: Props) => {
...
@@ -71,7 +71,7 @@ const ActivityCalendar = (props: Props) => {
)
:
(
)
:
(
<
div
<
div
key=
{
`${date}-${index}`
}
key=
{
`${date}-${index}`
}
className=
{
cl
assNames
(
className=
{
cl
sx
(
"shrink-0 opacity-30 w-4 h-4 rounded-md flex justify-center items-center border border-transparent"
,
"shrink-0 opacity-30 w-4 h-4 rounded-md flex justify-center items-center border border-transparent"
,
getCellAdditionalStyles
(
count
,
maxCount
),
getCellAdditionalStyles
(
count
,
maxCount
),
)
}
)
}
...
...
web/src/components/Dialog/BaseDialog.tsx
View file @
d8aeec99
import
{
CssVarsProvider
}
from
"@mui/joy"
;
import
{
CssVarsProvider
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useEffect
,
useRef
}
from
"react"
;
import
{
useEffect
,
useRef
}
from
"react"
;
import
{
createRoot
}
from
"react-dom/client"
;
import
{
createRoot
}
from
"react-dom/client"
;
import
{
Provider
}
from
"react-redux"
;
import
{
Provider
}
from
"react-redux"
;
...
@@ -56,8 +56,8 @@ const BaseDialog: React.FC<Props> = (props: Props) => {
...
@@ -56,8 +56,8 @@ const BaseDialog: React.FC<Props> = (props: Props) => {
};
};
return
(
return
(
<
div
className=
{
cl
assNames
(
"dialog-wrapper"
,
className
)
}
onMouseDown=
{
handleSpaceClicked
}
>
<
div
className=
{
cl
sx
(
"dialog-wrapper"
,
className
)
}
onMouseDown=
{
handleSpaceClicked
}
>
<
div
ref=
{
dialogContainerRef
}
className=
{
cl
assNames
(
"dialog-container"
)
}
onMouseDown=
{
(
e
)
=>
e
.
stopPropagation
()
}
>
<
div
ref=
{
dialogContainerRef
}
className=
{
cl
sx
(
"dialog-container"
)
}
onMouseDown=
{
(
e
)
=>
e
.
stopPropagation
()
}
>
{
children
}
{
children
}
</
div
>
</
div
>
</
div
>
</
div
>
...
...
web/src/components/ExploreSidebar/ExploreSidebar.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
SearchBar
from
"@/components/SearchBar"
;
import
SearchBar
from
"@/components/SearchBar"
;
import
UsersSection
from
"./UsersSection"
;
import
UsersSection
from
"./UsersSection"
;
...
@@ -9,7 +9,7 @@ interface Props {
...
@@ -9,7 +9,7 @@ interface Props {
const
ExploreSidebar
=
(
props
:
Props
)
=>
{
const
ExploreSidebar
=
(
props
:
Props
)
=>
{
return
(
return
(
<
aside
<
aside
className=
{
cl
assNames
(
className=
{
cl
sx
(
"relative w-full h-auto max-h-screen overflow-auto hide-scrollbar flex flex-col justify-start items-start"
,
"relative w-full h-auto max-h-screen overflow-auto hide-scrollbar flex flex-col justify-start items-start"
,
props
.
className
,
props
.
className
,
)
}
)
}
...
...
web/src/components/HomeSidebar/HomeSidebar.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
SearchBar
from
"@/components/SearchBar"
;
import
SearchBar
from
"@/components/SearchBar"
;
import
UserStatisticsView
from
"@/components/UserStatisticsView"
;
import
UserStatisticsView
from
"@/components/UserStatisticsView"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
...
@@ -13,7 +13,7 @@ const HomeSidebar = (props: Props) => {
...
@@ -13,7 +13,7 @@ const HomeSidebar = (props: Props) => {
return
(
return
(
<
aside
<
aside
className=
{
cl
assNames
(
className=
{
cl
sx
(
"relative w-full h-auto max-h-screen overflow-auto hide-scrollbar flex flex-col justify-start items-start"
,
"relative w-full h-auto max-h-screen overflow-auto hide-scrollbar flex flex-col justify-start items-start"
,
props
.
className
,
props
.
className
,
)
}
)
}
...
...
web/src/components/Inbox/MemoCommentMessage.tsx
View file @
d8aeec99
import
{
Tooltip
}
from
"@mui/joy"
;
import
{
Tooltip
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
toast
from
"react-hot-toast"
;
import
toast
from
"react-hot-toast"
;
import
{
activityServiceClient
}
from
"@/grpcweb"
;
import
{
activityServiceClient
}
from
"@/grpcweb"
;
...
@@ -73,7 +73,7 @@ const MemoCommentMessage = ({ inbox }: Props) => {
...
@@ -73,7 +73,7 @@ const MemoCommentMessage = ({ inbox }: Props) => {
return
(
return
(
<
div
className=
"w-full flex flex-row justify-start items-start gap-3"
>
<
div
className=
"w-full flex flex-row justify-start items-start gap-3"
>
<
div
<
div
className=
{
cl
assNames
(
className=
{
cl
sx
(
"shrink-0 mt-2 p-2 rounded-full border"
,
"shrink-0 mt-2 p-2 rounded-full border"
,
inbox
.
status
===
Inbox_Status
.
UNREAD
inbox
.
status
===
Inbox_Status
.
UNREAD
?
"border-blue-600 text-blue-600 bg-blue-50 dark:bg-zinc-800"
?
"border-blue-600 text-blue-600 bg-blue-50 dark:bg-zinc-800"
...
@@ -85,7 +85,7 @@ const MemoCommentMessage = ({ inbox }: Props) => {
...
@@ -85,7 +85,7 @@ const MemoCommentMessage = ({ inbox }: Props) => {
</
Tooltip
>
</
Tooltip
>
</
div
>
</
div
>
<
div
<
div
className=
{
cl
assNames
(
className=
{
cl
sx
(
"border w-full p-3 px-4 rounded-lg flex flex-col justify-start items-start gap-2 dark:border-zinc-700 hover:bg-gray-100 dark:hover:bg-zinc-700"
,
"border w-full p-3 px-4 rounded-lg flex flex-col justify-start items-start gap-2 dark:border-zinc-700 hover:bg-gray-100 dark:hover:bg-zinc-700"
,
inbox
.
status
!==
Inbox_Status
.
UNREAD
&&
"opacity-60"
,
inbox
.
status
!==
Inbox_Status
.
UNREAD
&&
"opacity-60"
,
)
}
)
}
...
...
web/src/components/Inbox/VersionUpdateMessage.tsx
View file @
d8aeec99
import
{
Tooltip
}
from
"@mui/joy"
;
import
{
Tooltip
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
toast
from
"react-hot-toast"
;
import
toast
from
"react-hot-toast"
;
import
{
activityServiceClient
}
from
"@/grpcweb"
;
import
{
activityServiceClient
}
from
"@/grpcweb"
;
...
@@ -58,7 +58,7 @@ const VersionUpdateMessage = ({ inbox }: Props) => {
...
@@ -58,7 +58,7 @@ const VersionUpdateMessage = ({ inbox }: Props) => {
return (
return (
<div className="w-full flex flex-row justify-start items-start gap-3">
<div className="w-full flex flex-row justify-start items-start gap-3">
<div
<div
className={cl
assNames
(
className={cl
sx
(
"shrink-0 mt-2 p-2 rounded-full border",
"shrink-0 mt-2 p-2 rounded-full border",
inbox.status === Inbox_Status.UNREAD
inbox.status === Inbox_Status.UNREAD
? "border-blue-600 text-blue-600 bg-blue-50 dark:bg-zinc-800"
? "border-blue-600 text-blue-600 bg-blue-50 dark:bg-zinc-800"
...
@@ -70,7 +70,7 @@ const VersionUpdateMessage = ({ inbox }: Props) => {
...
@@ -70,7 +70,7 @@ const VersionUpdateMessage = ({ inbox }: Props) => {
</Tooltip>
</Tooltip>
</div>
</div>
<div
<div
className={cl
assNames
(
className={cl
sx
(
"border w-full p-3 px-4 rounded-lg flex flex-col justify-start items-start gap-2 dark:border-zinc-700 hover:bg-gray-100 dark:hover:bg-zinc-700",
"border w-full p-3 px-4 rounded-lg flex flex-col justify-start items-start gap-2 dark:border-zinc-700 hover:bg-gray-100 dark:hover:bg-zinc-700",
inbox.status !== Inbox_Status.UNREAD && "opacity-60",
inbox.status !== Inbox_Status.UNREAD && "opacity-60",
)}
)}
...
...
web/src/components/MemoActionMenu.tsx
View file @
d8aeec99
import
{
Dropdown
,
Menu
,
MenuButton
,
MenuItem
}
from
"@mui/joy"
;
import
{
Dropdown
,
Menu
,
MenuButton
,
MenuItem
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
toast
from
"react-hot-toast"
;
import
toast
from
"react-hot-toast"
;
import
{
useLocation
}
from
"react-router-dom"
;
import
{
useLocation
}
from
"react-router-dom"
;
import
Icon
from
"@/components/Icon"
;
import
Icon
from
"@/components/Icon"
;
...
@@ -108,7 +108,7 @@ const MemoActionMenu = (props: Props) => {
...
@@ -108,7 +108,7 @@ const MemoActionMenu = (props: Props) => {
return
(
return
(
<
Dropdown
>
<
Dropdown
>
<
MenuButton
slots=
{
{
root
:
"div"
}
}
>
<
MenuButton
slots=
{
{
root
:
"div"
}
}
>
<
span
className=
{
cl
assNames
(
"flex justify-center items-center rounded-full hover:opacity-70"
,
props
.
className
)
}
>
<
span
className=
{
cl
sx
(
"flex justify-center items-center rounded-full hover:opacity-70"
,
props
.
className
)
}
>
<
Icon
.
MoreVertical
className=
"w-4 h-4 mx-auto text-gray-500 dark:text-gray-400"
/>
<
Icon
.
MoreVertical
className=
"w-4 h-4 mx-auto text-gray-500 dark:text-gray-400"
/>
</
span
>
</
span
>
</
MenuButton
>
</
MenuButton
>
...
...
web/src/components/MemoContent/CodeBlock.tsx
View file @
d8aeec99
import
{
Checkbox
}
from
"@mui/joy"
;
import
{
Checkbox
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
copy
from
"copy-to-clipboard"
;
import
copy
from
"copy-to-clipboard"
;
import
hljs
from
"highlight.js"
;
import
hljs
from
"highlight.js"
;
import
{
useCallback
,
useMemo
,
useState
}
from
"react"
;
import
{
useCallback
,
useMemo
,
useState
}
from
"react"
;
...
@@ -65,11 +65,9 @@ const CodeBlock: React.FC<Props> = ({ language, content }: Props) => {
...
@@ -65,11 +65,9 @@ const CodeBlock: React.FC<Props> = ({ language, content }: Props) => {
</
div
>
</
div
>
<
div
className=
"overflow-auto"
>
<
div
className=
"overflow-auto"
>
<
pre
<
pre
className=
{
clsx
(
wrap
?
"whitespace-pre-wrap"
:
"no-wrap overflow-auto"
,
"w-full p-2 bg-amber-50 dark:bg-zinc-700 relative"
)
}
>
className=
{
classNames
(
wrap
?
"whitespace-pre-wrap"
:
"no-wrap overflow-auto"
,
"w-full p-2 bg-amber-50 dark:bg-zinc-700 relative"
)
}
>
<
code
<
code
className=
{
cl
assNames
(
`language-${formatedLanguage}`
,
"block text-sm leading-5"
)
}
className=
{
cl
sx
(
`language-${formatedLanguage}`
,
"block text-sm leading-5"
)
}
dangerouslySetInnerHTML=
{
{
__html
:
highlightedCode
}
}
dangerouslySetInnerHTML=
{
{
__html
:
highlightedCode
}
}
></
code
>
></
code
>
</
pre
>
</
pre
>
...
...
web/src/components/MemoContent/EmbeddedContent/EmbeddedResource.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useEffect
}
from
"react"
;
import
{
useEffect
}
from
"react"
;
import
MemoResourceListView
from
"@/components/MemoResourceListView"
;
import
MemoResourceListView
from
"@/components/MemoResourceListView"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
useLoading
from
"@/hooks/useLoading"
;
...
@@ -53,7 +53,7 @@ const EmbeddedResource = ({ resourceId, params: paramsStr }: Props) => {
...
@@ -53,7 +53,7 @@ const EmbeddedResource = ({ resourceId, params: paramsStr }: Props) => {
}
}
return
(
return
(
<
div
className=
{
cl
assNames
(
"max-w-full"
,
getAdditionalClassNameWithParams
(
params
))
}
>
<
div
className=
{
cl
sx
(
"max-w-full"
,
getAdditionalClassNameWithParams
(
params
))
}
>
<
MemoResourceListView
resources=
{
[
resource
]
}
/>
<
MemoResourceListView
resources=
{
[
resource
]
}
/>
</
div
>
</
div
>
);
);
...
...
web/src/components/MemoContent/Spoiler.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
interface
Props
{
interface
Props
{
...
@@ -10,10 +10,10 @@ const Spoiler: React.FC<Props> = ({ content }: Props) => {
...
@@ -10,10 +10,10 @@ const Spoiler: React.FC<Props> = ({ content }: Props) => {
return
(
return
(
<
span
<
span
className=
{
cl
assNames
(
"inline cursor-pointer select-none"
,
isRevealed
?
""
:
"bg-gray-200 dark:bg-zinc-700"
)
}
className=
{
cl
sx
(
"inline cursor-pointer select-none"
,
isRevealed
?
""
:
"bg-gray-200 dark:bg-zinc-700"
)
}
onClick=
{
()
=>
setIsRevealed
(
!
isRevealed
)
}
onClick=
{
()
=>
setIsRevealed
(
!
isRevealed
)
}
>
>
<
span
className=
{
cl
assNames
(
isRevealed
?
"opacity-100"
:
"opacity-0"
)
}
>
{
content
}
</
span
>
<
span
className=
{
cl
sx
(
isRevealed
?
"opacity-100"
:
"opacity-0"
)
}
>
{
content
}
</
span
>
</
span
>
</
span
>
);
);
};
};
...
...
web/src/components/MemoContent/Tag.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useContext
}
from
"react"
;
import
{
useContext
}
from
"react"
;
import
{
useFilterStore
}
from
"@/store/module"
;
import
{
useFilterStore
}
from
"@/store/module"
;
import
{
RendererContext
}
from
"./types"
;
import
{
RendererContext
}
from
"./types"
;
...
@@ -26,7 +26,7 @@ const Tag: React.FC<Props> = ({ content }: Props) => {
...
@@ -26,7 +26,7 @@ const Tag: React.FC<Props> = ({ content }: Props) => {
return
(
return
(
<
span
<
span
className=
{
cl
assNames
(
className=
{
cl
sx
(
"inline-block w-auto text-blue-600 dark:text-blue-400"
,
"inline-block w-auto text-blue-600 dark:text-blue-400"
,
context
.
disableFilter
?
""
:
"cursor-pointer hover:opacity-80"
,
context
.
disableFilter
?
""
:
"cursor-pointer hover:opacity-80"
,
)
}
)
}
...
...
web/src/components/MemoContent/TaskList.tsx
View file @
d8aeec99
import
{
Checkbox
}
from
"@mui/joy"
;
import
{
Checkbox
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
repeat
}
from
"lodash-es"
;
import
{
repeat
}
from
"lodash-es"
;
import
{
useContext
,
useState
}
from
"react"
;
import
{
useContext
,
useState
}
from
"react"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
...
@@ -58,7 +58,7 @@ const TaskList: React.FC<Props> = ({ index, indent, complete, children }: Props)
...
@@ -58,7 +58,7 @@ const TaskList: React.FC<Props> = ({ index, indent, complete, children }: Props)
<
div
className=
"w-7 h-6 flex justify-center items-center"
>
<
div
className=
"w-7 h-6 flex justify-center items-center"
>
<
Checkbox
size=
"sm"
checked=
{
checked
}
disabled=
{
context
.
readonly
}
onChange=
{
(
e
)
=>
handleCheckboxChange
(
e
.
target
.
checked
)
}
/>
<
Checkbox
size=
"sm"
checked=
{
checked
}
disabled=
{
context
.
readonly
}
onChange=
{
(
e
)
=>
handleCheckboxChange
(
e
.
target
.
checked
)
}
/>
</
div
>
</
div
>
<
div
className=
{
cl
assNames
(
complete
&&
"line-through opacity-80"
)
}
>
<
div
className=
{
cl
sx
(
complete
&&
"line-through opacity-80"
)
}
>
{
children
.
map
((
child
,
index
)
=>
(
{
children
.
map
((
child
,
index
)
=>
(
<
Renderer
key=
{
`${child.type}-${index}`
}
index=
{
String
(
index
)
}
node=
{
child
}
/>
<
Renderer
key=
{
`${child.type}-${index}`
}
index=
{
String
(
index
)
}
node=
{
child
}
/>
))
}
))
}
...
...
web/src/components/MemoContent/index.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
memo
,
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
memo
,
useEffect
,
useRef
,
useState
}
from
"react"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
...
@@ -71,7 +71,7 @@ const MemoContent: React.FC<Props> = (props: Props) => {
...
@@ -71,7 +71,7 @@ const MemoContent: React.FC<Props> = (props: Props) => {
<
div
className=
{
`w-full flex flex-col justify-start items-start text-gray-800 dark:text-gray-400 ${className || ""}`
}
>
<
div
className=
{
`w-full flex flex-col justify-start items-start text-gray-800 dark:text-gray-400 ${className || ""}`
}
>
<
div
<
div
ref=
{
memoContentContainerRef
}
ref=
{
memoContentContainerRef
}
className=
{
cl
assNames
(
className=
{
cl
sx
(
"w-full max-w-full word-break text-base leading-snug space-y-2 whitespace-pre-wrap"
,
"w-full max-w-full word-break text-base leading-snug space-y-2 whitespace-pre-wrap"
,
showCompactMode
&&
"line-clamp-6"
,
showCompactMode
&&
"line-clamp-6"
,
)
}
)
}
...
...
web/src/components/MemoEditor/Editor/TagSuggestions.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
Fuse
from
"fuse.js"
;
import
Fuse
from
"fuse.js"
;
import
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
getCaretCoordinates
from
"textarea-caret"
;
import
getCaretCoordinates
from
"textarea-caret"
;
...
@@ -110,7 +110,7 @@ const TagSuggestions = ({ editorRef, editorActions }: Props) => {
...
@@ -110,7 +110,7 @@ const TagSuggestions = ({ editorRef, editorActions }: Props) => {
<
div
<
div
key=
{
tag
}
key=
{
tag
}
onMouseDown=
{
()
=>
autocomplete
(
tag
)
}
onMouseDown=
{
()
=>
autocomplete
(
tag
)
}
className=
{
cl
assNames
(
className=
{
cl
sx
(
"rounded p-1 px-2 w-full truncate text-sm dark:text-gray-300 cursor-pointer hover:bg-zinc-200 dark:hover:bg-zinc-800"
,
"rounded p-1 px-2 w-full truncate text-sm dark:text-gray-300 cursor-pointer hover:bg-zinc-200 dark:hover:bg-zinc-800"
,
i
===
selected
?
"bg-zinc-300 dark:bg-zinc-600"
:
""
,
i
===
selected
?
"bg-zinc-300 dark:bg-zinc-600"
:
""
,
)
}
)
}
...
...
web/src/components/MemoEditor/Editor/index.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
last
}
from
"lodash-es"
;
import
{
last
}
from
"lodash-es"
;
import
{
forwardRef
,
ReactNode
,
useCallback
,
useEffect
,
useImperativeHandle
,
useRef
,
useState
}
from
"react"
;
import
{
forwardRef
,
ReactNode
,
useCallback
,
useEffect
,
useImperativeHandle
,
useRef
,
useState
}
from
"react"
;
import
{
NodeType
,
OrderedListNode
,
TaskListNode
,
UnorderedListNode
}
from
"@/types/node"
;
import
{
NodeType
,
OrderedListNode
,
TaskListNode
,
UnorderedListNode
}
from
"@/types/node"
;
...
@@ -178,7 +178,7 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef<
...
@@ -178,7 +178,7 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef<
return
(
return
(
<
div
<
div
className=
{
cl
assNames
(
className=
{
cl
sx
(
"flex flex-col justify-start items-start relative w-full h-auto max-h-[256px] bg-inherit dark:text-gray-300"
,
"flex flex-col justify-start items-start relative w-full h-auto max-h-[256px] bg-inherit dark:text-gray-300"
,
className
,
className
,
)
}
)
}
...
...
web/src/components/MemoFilter.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useEffect
}
from
"react"
;
import
{
useEffect
}
from
"react"
;
import
{
useLocation
}
from
"react-router-dom"
;
import
{
useLocation
}
from
"react-router-dom"
;
import
{
useFilterStore
}
from
"@/store/module"
;
import
{
useFilterStore
}
from
"@/store/module"
;
...
@@ -27,7 +27,7 @@ const MemoFilter = (props: Props) => {
...
@@ -27,7 +27,7 @@ const MemoFilter = (props: Props) => {
return
(
return
(
<
div
<
div
className=
{
cl
assNames
(
className=
{
cl
sx
(
`w-full flex flex-row justify-start items-start flex-wrap gap-2 text-sm leading-7 dark:text-gray-400`
,
`w-full flex flex-row justify-start items-start flex-wrap gap-2 text-sm leading-7 dark:text-gray-400`
,
props
.
className
,
props
.
className
,
)
}
)
}
...
...
web/src/components/MemoView.tsx
View file @
d8aeec99
import
{
Tooltip
}
from
"@mui/joy"
;
import
{
Tooltip
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
memo
,
useCallback
,
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
memo
,
useCallback
,
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
Link
,
useLocation
}
from
"react-router-dom"
;
import
{
Link
,
useLocation
}
from
"react-router-dom"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
...
@@ -77,7 +77,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
...
@@ -77,7 +77,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
return
(
return
(
<
div
<
div
className=
{
cl
assNames
(
className=
{
cl
sx
(
"group relative flex flex-col justify-start items-start w-full px-4 py-3 mb-2 gap-2 bg-white dark:bg-zinc-800 rounded-lg border border-white dark:border-zinc-800 hover:border-gray-200 dark:hover:border-zinc-700"
,
"group relative flex flex-col justify-start items-start w-full px-4 py-3 mb-2 gap-2 bg-white dark:bg-zinc-800 rounded-lg border border-white dark:border-zinc-800 hover:border-gray-200 dark:hover:border-zinc-700"
,
props
.
showPinned
&&
memo
.
pinned
&&
"border-gray-200 border dark:border-zinc-700"
,
props
.
showPinned
&&
memo
.
pinned
&&
"border-gray-200 border dark:border-zinc-700"
,
className
,
className
,
...
@@ -126,7 +126,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
...
@@ -126,7 +126,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
</
div
>
</
div
>
{
!
isInMemoDetailPage
&&
(
{
!
isInMemoDetailPage
&&
(
<
Link
<
Link
className=
{
cl
assNames
(
className=
{
cl
sx
(
"flex flex-row justify-start items-center hover:opacity-70"
,
"flex flex-row justify-start items-center hover:opacity-70"
,
commentAmount
===
0
&&
"invisible group-hover:visible"
,
commentAmount
===
0
&&
"invisible group-hover:visible"
,
)
}
)
}
...
...
web/src/components/MobileHeader.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
import
useWindowScroll
from
"react-use/lib/useWindowScroll"
;
import
useWindowScroll
from
"react-use/lib/useWindowScroll"
;
import
useResponsiveWidth
from
"@/hooks/useResponsiveWidth"
;
import
useResponsiveWidth
from
"@/hooks/useResponsiveWidth"
;
...
@@ -17,7 +17,7 @@ const MobileHeader = (props: Props) => {
...
@@ -17,7 +17,7 @@ const MobileHeader = (props: Props) => {
return
(
return
(
<
div
<
div
className=
{
cl
assNames
(
className=
{
cl
sx
(
"sticky top-0 pt-3 pb-2 sm:pt-2 px-4 sm:px-6 sm:mb-1 bg-zinc-100 dark:bg-zinc-900 bg-opacity-80 backdrop-blur-lg flex md:hidden flex-row justify-between items-center w-full h-auto flex-nowrap shrink-0 z-1"
,
"sticky top-0 pt-3 pb-2 sm:pt-2 px-4 sm:px-6 sm:mb-1 bg-zinc-100 dark:bg-zinc-900 bg-opacity-80 backdrop-blur-lg flex md:hidden flex-row justify-between items-center w-full h-auto flex-nowrap shrink-0 z-1"
,
offsetTop
>
0
&&
"shadow-md"
,
offsetTop
>
0
&&
"shadow-md"
,
className
,
className
,
...
...
web/src/components/Navigation.tsx
View file @
d8aeec99
import
{
Tooltip
}
from
"@mui/joy"
;
import
{
Tooltip
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useEffect
}
from
"react"
;
import
{
useEffect
}
from
"react"
;
import
{
NavLink
}
from
"react-router-dom"
;
import
{
NavLink
}
from
"react-router-dom"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
...
@@ -122,17 +122,14 @@ const Navigation = (props: Props) => {
...
@@ -122,17 +122,14 @@ const Navigation = (props: Props) => {
return
(
return
(
<
header
<
header
className=
{
classNames
(
className=
{
clsx
(
"w-full h-full overflow-auto flex flex-col justify-start items-start py-4 md:pt-6 z-30 hide-scrollbar"
,
className
)
}
"w-full h-full overflow-auto flex flex-col justify-start items-start py-4 md:pt-6 z-30 hide-scrollbar"
,
className
,
)
}
>
>
<
UserBanner
collapsed=
{
collapsed
}
/>
<
UserBanner
collapsed=
{
collapsed
}
/>
<
div
className=
"w-full px-1 py-2 flex flex-col justify-start items-start shrink-0 space-y-2"
>
<
div
className=
"w-full px-1 py-2 flex flex-col justify-start items-start shrink-0 space-y-2"
>
{
navLinks
.
map
((
navLink
)
=>
(
{
navLinks
.
map
((
navLink
)
=>
(
<
NavLink
<
NavLink
className=
{
({
isActive
})
=>
className=
{
({
isActive
})
=>
cl
assNames
(
cl
sx
(
"px-2 py-2 rounded-2xl border flex flex-row items-center text-lg text-gray-800 dark:text-gray-400 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-700 dark:hover:bg-zinc-800"
,
"px-2 py-2 rounded-2xl border flex flex-row items-center text-lg text-gray-800 dark:text-gray-400 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-700 dark:hover:bg-zinc-800"
,
collapsed
?
""
:
"w-full px-4"
,
collapsed
?
""
:
"w-full px-4"
,
isActive
?
"bg-white drop-shadow-sm dark:bg-zinc-800 border-gray-200 dark:border-zinc-700"
:
"border-transparent"
,
isActive
?
"bg-white drop-shadow-sm dark:bg-zinc-800 border-gray-200 dark:border-zinc-700"
:
"border-transparent"
,
...
...
web/src/components/ReactionSelector.tsx
View file @
d8aeec99
import
{
Dropdown
,
Menu
,
MenuButton
}
from
"@mui/joy"
;
import
{
Dropdown
,
Menu
,
MenuButton
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useRef
,
useState
}
from
"react"
;
import
{
useRef
,
useState
}
from
"react"
;
import
useClickAway
from
"react-use/lib/useClickAway"
;
import
useClickAway
from
"react-use/lib/useClickAway"
;
import
Icon
from
"@/components/Icon"
;
import
Icon
from
"@/components/Icon"
;
...
@@ -74,10 +74,7 @@ const ReactionSelector = (props: Props) => {
...
@@ -74,10 +74,7 @@ const ReactionSelector = (props: Props) => {
<
Dropdown
open=
{
open
}
onOpenChange=
{
(
_
,
isOpen
)
=>
setOpen
(
isOpen
)
}
>
<
Dropdown
open=
{
open
}
onOpenChange=
{
(
_
,
isOpen
)
=>
setOpen
(
isOpen
)
}
>
<
MenuButton
slots=
{
{
root
:
"div"
}
}
>
<
MenuButton
slots=
{
{
root
:
"div"
}
}
>
<
span
<
span
className=
{
classNames
(
className=
{
clsx
(
"h-7 w-7 flex justify-center items-center rounded-full border dark:border-zinc-700 hover:opacity-70"
,
className
)
}
"h-7 w-7 flex justify-center items-center rounded-full border dark:border-zinc-700 hover:opacity-70"
,
className
,
)
}
>
>
<
Icon
.
SmilePlus
className=
"w-4 h-4 mx-auto text-gray-500 dark:text-gray-400"
/>
<
Icon
.
SmilePlus
className=
"w-4 h-4 mx-auto text-gray-500 dark:text-gray-400"
/>
</
span
>
</
span
>
...
@@ -89,7 +86,7 @@ const ReactionSelector = (props: Props) => {
...
@@ -89,7 +86,7 @@ const ReactionSelector = (props: Props) => {
return
(
return
(
<
span
<
span
key=
{
reactionType
}
key=
{
reactionType
}
className=
{
cl
assNames
(
className=
{
cl
sx
(
"inline-flex w-auto cursor-pointer rounded text-lg px-1 text-gray-500 dark:text-gray-400 hover:opacity-80"
,
"inline-flex w-auto cursor-pointer rounded text-lg px-1 text-gray-500 dark:text-gray-400 hover:opacity-80"
,
hasReacted
(
reactionType
)
&&
"bg-blue-100 dark:bg-zinc-800"
,
hasReacted
(
reactionType
)
&&
"bg-blue-100 dark:bg-zinc-800"
,
)
}
)
}
...
...
web/src/components/ReactionView.tsx
View file @
d8aeec99
import
{
Tooltip
}
from
"@mui/joy"
;
import
{
Tooltip
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
memoServiceClient
}
from
"@/grpcweb"
;
import
{
memoServiceClient
}
from
"@/grpcweb"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
...
@@ -97,7 +97,7 @@ const ReactionView = (props: Props) => {
...
@@ -97,7 +97,7 @@ const ReactionView = (props: Props) => {
return
(
return
(
<
Tooltip
title=
{
stringifyUsers
(
users
,
reactionType
)
}
placement=
"top"
>
<
Tooltip
title=
{
stringifyUsers
(
users
,
reactionType
)
}
placement=
"top"
>
<
div
<
div
className=
{
cl
assNames
(
className=
{
cl
sx
(
"h-7 border px-2 py-0.5 rounded-full font-memo flex flex-row justify-center items-center gap-1 dark:border-zinc-700"
,
"h-7 border px-2 py-0.5 rounded-full font-memo flex flex-row justify-center items-center gap-1 dark:border-zinc-700"
,
currentUser
&&
"cursor-pointer"
,
currentUser
&&
"cursor-pointer"
,
hasReaction
&&
"bg-blue-100 border-blue-200 dark:bg-zinc-900"
,
hasReaction
&&
"bg-blue-100 border-blue-200 dark:bg-zinc-900"
,
...
...
web/src/components/ResourceIcon.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
React
from
"react"
;
import
React
from
"react"
;
import
{
Resource
}
from
"@/types/proto/api/v1/resource_service"
;
import
{
Resource
}
from
"@/types/proto/api/v1/resource_service"
;
import
{
getResourceType
,
getResourceUrl
}
from
"@/utils/resource"
;
import
{
getResourceType
,
getResourceUrl
}
from
"@/utils/resource"
;
...
@@ -16,7 +16,7 @@ const ResourceIcon = (props: Props) => {
...
@@ -16,7 +16,7 @@ const ResourceIcon = (props: Props) => {
const
{
resource
}
=
props
;
const
{
resource
}
=
props
;
const
resourceType
=
getResourceType
(
resource
);
const
resourceType
=
getResourceType
(
resource
);
const
resourceUrl
=
getResourceUrl
(
resource
);
const
resourceUrl
=
getResourceUrl
(
resource
);
const
className
=
cl
assNames
(
"w-full h-auto"
,
props
.
className
);
const
className
=
cl
sx
(
"w-full h-auto"
,
props
.
className
);
const
strokeWidth
=
props
.
strokeWidth
;
const
strokeWidth
=
props
.
strokeWidth
;
const
previewResource
=
()
=>
{
const
previewResource
=
()
=>
{
...
@@ -25,7 +25,7 @@ const ResourceIcon = (props: Props) => {
...
@@ -25,7 +25,7 @@ const ResourceIcon = (props: Props) => {
if
(
resourceType
===
"image/*"
)
{
if
(
resourceType
===
"image/*"
)
{
return
(
return
(
<
SquareDiv
className=
{
cl
assNames
(
className
,
"flex items-center justify-center overflow-clip"
)
}
>
<
SquareDiv
className=
{
cl
sx
(
className
,
"flex items-center justify-center overflow-clip"
)
}
>
<
img
<
img
className=
"min-w-full min-h-full object-cover border rounded dark:border-none"
className=
"min-w-full min-h-full object-cover border rounded dark:border-none"
src=
{
resource
.
externalLink
?
resourceUrl
:
resourceUrl
+
"?thumbnail=1"
}
src=
{
resource
.
externalLink
?
resourceUrl
:
resourceUrl
+
"?thumbnail=1"
}
...
@@ -63,7 +63,7 @@ const ResourceIcon = (props: Props) => {
...
@@ -63,7 +63,7 @@ const ResourceIcon = (props: Props) => {
};
};
return
(
return
(
<
div
onClick=
{
previewResource
}
className=
{
cl
assNames
(
className
,
"max-w-[4rem] opacity-50"
)
}
>
<
div
onClick=
{
previewResource
}
className=
{
cl
sx
(
className
,
"max-w-[4rem] opacity-50"
)
}
>
{
getResourceIcon
()
}
{
getResourceIcon
()
}
</
div
>
</
div
>
);
);
...
...
web/src/components/TimelineSidebar/TimelineSidebar.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
TagsSection
from
"../HomeSidebar/TagsSection"
;
import
TagsSection
from
"../HomeSidebar/TagsSection"
;
import
SearchBar
from
"../SearchBar"
;
import
SearchBar
from
"../SearchBar"
;
...
@@ -9,7 +9,7 @@ interface Props {
...
@@ -9,7 +9,7 @@ interface Props {
const
TimelineSidebar
=
(
props
:
Props
)
=>
{
const
TimelineSidebar
=
(
props
:
Props
)
=>
{
return
(
return
(
<
aside
<
aside
className=
{
cl
assNames
(
className=
{
cl
sx
(
"relative w-full h-auto max-h-screen overflow-auto hide-scrollbar flex flex-col justify-start items-start"
,
"relative w-full h-auto max-h-screen overflow-auto hide-scrollbar flex flex-col justify-start items-start"
,
props
.
className
,
props
.
className
,
)
}
)
}
...
...
web/src/components/UserAvatar.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
interface
Props
{
interface
Props
{
avatarUrl
?:
string
;
avatarUrl
?:
string
;
...
@@ -8,7 +8,7 @@ interface Props {
...
@@ -8,7 +8,7 @@ interface Props {
const
UserAvatar
=
(
props
:
Props
)
=>
{
const
UserAvatar
=
(
props
:
Props
)
=>
{
const
{
avatarUrl
,
className
}
=
props
;
const
{
avatarUrl
,
className
}
=
props
;
return
(
return
(
<
div
className=
{
cl
assNames
(
`w-8 h-8 overflow-clip rounded-xl`
,
className
)
}
>
<
div
className=
{
cl
sx
(
`w-8 h-8 overflow-clip rounded-xl`
,
className
)
}
>
<
img
<
img
className=
"w-full h-auto shadow min-w-full min-h-full object-cover dark:opacity-80"
className=
"w-full h-auto shadow min-w-full min-h-full object-cover dark:opacity-80"
src=
{
avatarUrl
||
"/full-logo.webp"
}
src=
{
avatarUrl
||
"/full-logo.webp"
}
...
...
web/src/components/UserBanner.tsx
View file @
d8aeec99
import
{
Dropdown
,
Menu
,
MenuButton
,
MenuItem
}
from
"@mui/joy"
;
import
{
Dropdown
,
Menu
,
MenuButton
,
MenuItem
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
authServiceClient
}
from
"@/grpcweb"
;
import
{
authServiceClient
}
from
"@/grpcweb"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
...
@@ -30,7 +30,7 @@ const UserBanner = (props: Props) => {
...
@@ -30,7 +30,7 @@ const UserBanner = (props: Props) => {
<
Dropdown
>
<
Dropdown
>
<
MenuButton
disabled=
{
!
user
}
slots=
{
{
root
:
"div"
}
}
>
<
MenuButton
disabled=
{
!
user
}
slots=
{
{
root
:
"div"
}
}
>
<
div
<
div
className=
{
cl
assNames
(
className=
{
cl
sx
(
"py-1 my-1 w-auto flex flex-row justify-start items-center cursor-pointer rounded-2xl border border-transparent text-gray-800 dark:text-gray-400"
,
"py-1 my-1 w-auto flex flex-row justify-start items-center cursor-pointer rounded-2xl border border-transparent text-gray-800 dark:text-gray-400"
,
collapsed
?
"px-1"
:
"px-3"
,
collapsed
?
"px-1"
:
"px-3"
,
)
}
)
}
...
...
web/src/components/VisibilityIcon.tsx
View file @
d8aeec99
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
Visibility
}
from
"@/types/proto/api/v1/memo_service"
;
import
{
Visibility
}
from
"@/types/proto/api/v1/memo_service"
;
import
Icon
from
"./Icon"
;
import
Icon
from
"./Icon"
;
...
@@ -21,7 +21,7 @@ const VisibilityIcon = (props: Props) => {
...
@@ -21,7 +21,7 @@ const VisibilityIcon = (props: Props) => {
return
null
;
return
null
;
}
}
return
<
VIcon
className=
{
cl
assNames
(
"w-4 h-auto text-gray-500 dark:text-gray-400"
)
}
/>;
return
<
VIcon
className=
{
cl
sx
(
"w-4 h-auto text-gray-500 dark:text-gray-400"
)
}
/>;
};
};
export
default
VisibilityIcon
;
export
default
VisibilityIcon
;
web/src/components/kit/OverflowTip.tsx
View file @
d8aeec99
import
{
Tooltip
}
from
"@mui/joy"
;
import
{
Tooltip
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useRef
,
useState
,
useEffect
}
from
"react"
;
import
{
useRef
,
useState
,
useEffect
}
from
"react"
;
interface
Props
{
interface
Props
{
...
@@ -21,7 +21,7 @@ const OverflowTip = ({ children, className }: Props) => {
...
@@ -21,7 +21,7 @@ const OverflowTip = ({ children, className }: Props) => {
return
(
return
(
<
Tooltip
title=
{
children
}
placement=
"top"
arrow
disableHoverListener=
{
!
isOverflowed
}
>
<
Tooltip
title=
{
children
}
placement=
"top"
arrow
disableHoverListener=
{
!
isOverflowed
}
>
<
div
ref=
{
textElementRef
}
className=
{
cl
assNames
(
"truncate"
,
className
)
}
>
<
div
ref=
{
textElementRef
}
className=
{
cl
sx
(
"truncate"
,
className
)
}
>
{
children
}
{
children
}
</
div
>
</
div
>
</
Tooltip
>
</
Tooltip
>
...
...
web/src/layouts/HomeLayout.tsx
View file @
d8aeec99
import
{
Button
,
IconButton
,
Tooltip
}
from
"@mui/joy"
;
import
{
Button
,
IconButton
,
Tooltip
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
Suspense
,
useEffect
}
from
"react"
;
import
{
Suspense
,
useEffect
}
from
"react"
;
import
{
Outlet
,
useLocation
}
from
"react-router-dom"
;
import
{
Outlet
,
useLocation
}
from
"react-router-dom"
;
import
useLocalStorage
from
"react-use/lib/useLocalStorage"
;
import
useLocalStorage
from
"react-use/lib/useLocalStorage"
;
...
@@ -32,23 +32,18 @@ const HomeLayout = () => {
...
@@ -32,23 +32,18 @@ const HomeLayout = () => {
return
(
return
(
<
div
className=
"w-full min-h-full"
>
<
div
className=
"w-full min-h-full"
>
<
div
<
div
className=
{
clsx
(
"w-full transition-all mx-auto flex flex-row justify-center items-start"
,
collapsed
?
"sm:pl-16"
:
"sm:pl-56"
)
}
>
className=
{
classNames
(
"w-full transition-all mx-auto flex flex-row justify-center items-start"
,
collapsed
?
"sm:pl-16"
:
"sm:pl-56"
,
)
}
>
{
sm
&&
(
{
sm
&&
(
<
div
<
div
className=
{
cl
assNames
(
className=
{
cl
sx
(
"group flex flex-col justify-start items-start fixed top-0 left-0 select-none border-r dark:border-zinc-800 h-full bg-zinc-50 dark:bg-zinc-800 dark:bg-opacity-40 transition-all hover:shadow-xl z-2"
,
"group flex flex-col justify-start items-start fixed top-0 left-0 select-none border-r dark:border-zinc-800 h-full bg-zinc-50 dark:bg-zinc-800 dark:bg-opacity-40 transition-all hover:shadow-xl z-2"
,
collapsed
?
"w-16 px-2"
:
"w-56 px-4"
,
collapsed
?
"w-16 px-2"
:
"w-56 px-4"
,
)
}
)
}
>
>
<
Navigation
className=
"!h-auto"
collapsed=
{
collapsed
}
/>
<
Navigation
className=
"!h-auto"
collapsed=
{
collapsed
}
/>
<
div
className=
{
cl
assNames
(
"w-full grow h-auto flex flex-col justify-end"
,
collapsed
?
"items-center"
:
"items-start"
)
}
>
<
div
className=
{
cl
sx
(
"w-full grow h-auto flex flex-col justify-end"
,
collapsed
?
"items-center"
:
"items-start"
)
}
>
<
div
<
div
className=
{
cl
assNames
(
"hidden py-3 group-hover:flex flex-col justify-center items-center"
)
}
className=
{
cl
sx
(
"hidden py-3 group-hover:flex flex-col justify-center items-center"
)
}
onClick=
{
()
=>
setCollapsed
(
!
collapsed
)
}
onClick=
{
()
=>
setCollapsed
(
!
collapsed
)
}
>
>
{
!
collapsed
?
(
{
!
collapsed
?
(
...
...
web/src/pages/Explore.tsx
View file @
d8aeec99
import
{
Button
}
from
"@mui/joy"
;
import
{
Button
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
Empty
from
"@/components/Empty"
;
import
Empty
from
"@/components/Empty"
;
import
{
ExploreSidebar
,
ExploreSidebarDrawer
}
from
"@/components/ExploreSidebar"
;
import
{
ExploreSidebar
,
ExploreSidebarDrawer
}
from
"@/components/ExploreSidebar"
;
...
@@ -61,8 +61,8 @@ const Explore = () => {
...
@@ -61,8 +61,8 @@ const Explore = () => {
<
ExploreSidebarDrawer
/>
<
ExploreSidebarDrawer
/>
</
MobileHeader
>
</
MobileHeader
>
)
}
)
}
<
div
className=
{
cl
assNames
(
"w-full flex flex-row justify-start items-start px-4 sm:px-6 gap-4"
)
}
>
<
div
className=
{
cl
sx
(
"w-full flex flex-row justify-start items-start px-4 sm:px-6 gap-4"
)
}
>
<
div
className=
{
cl
assNames
(
md
?
"w-[calc(100%-15rem)]"
:
"w-full"
)
}
>
<
div
className=
{
cl
sx
(
md
?
"w-[calc(100%-15rem)]"
:
"w-full"
)
}
>
<
div
className=
"flex flex-col justify-start items-start w-full max-w-full"
>
<
div
className=
"flex flex-col justify-start items-start w-full max-w-full"
>
<
MemoFilter
className=
"px-2 pb-2"
/>
<
MemoFilter
className=
"px-2 pb-2"
/>
{
sortedMemos
.
map
((
memo
)
=>
(
{
sortedMemos
.
map
((
memo
)
=>
(
...
...
web/src/pages/Home.tsx
View file @
d8aeec99
import
{
Button
}
from
"@mui/joy"
;
import
{
Button
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
useCallback
,
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
useCallback
,
useEffect
,
useRef
,
useState
}
from
"react"
;
import
Empty
from
"@/components/Empty"
;
import
Empty
from
"@/components/Empty"
;
import
{
HomeSidebar
,
HomeSidebarDrawer
}
from
"@/components/HomeSidebar"
;
import
{
HomeSidebar
,
HomeSidebarDrawer
}
from
"@/components/HomeSidebar"
;
...
@@ -75,8 +75,8 @@ const Home = () => {
...
@@ -75,8 +75,8 @@ const Home = () => {
<
HomeSidebarDrawer
/>
<
HomeSidebarDrawer
/>
</
MobileHeader
>
</
MobileHeader
>
)
}
)
}
<
div
className=
{
cl
assNames
(
"w-full flex flex-row justify-start items-start px-4 sm:px-6 gap-4"
)
}
>
<
div
className=
{
cl
sx
(
"w-full flex flex-row justify-start items-start px-4 sm:px-6 gap-4"
)
}
>
<
div
className=
{
cl
assNames
(
md
?
"w-[calc(100%-15rem)]"
:
"w-full"
)
}
>
<
div
className=
{
cl
sx
(
md
?
"w-[calc(100%-15rem)]"
:
"w-full"
)
}
>
<
MemoEditor
className=
"mb-2"
cacheKey=
"home-memo-editor"
onEditPrevious=
{
handleEditPrevious
}
/>
<
MemoEditor
className=
"mb-2"
cacheKey=
"home-memo-editor"
onEditPrevious=
{
handleEditPrevious
}
/>
<
div
className=
"flex flex-col justify-start items-start w-full max-w-full"
>
<
div
className=
"flex flex-col justify-start items-start w-full max-w-full"
>
<
MemoFilter
className=
"px-2 pb-2"
/>
<
MemoFilter
className=
"px-2 pb-2"
/>
...
...
web/src/pages/Timeline.tsx
View file @
d8aeec99
import
{
Button
,
Divider
,
IconButton
}
from
"@mui/joy"
;
import
{
Button
,
Divider
,
IconButton
}
from
"@mui/joy"
;
import
cl
assNames
from
"classnames
"
;
import
cl
sx
from
"clsx
"
;
import
{
Fragment
,
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
Fragment
,
useEffect
,
useRef
,
useState
}
from
"react"
;
import
ActivityCalendar
from
"@/components/ActivityCalendar"
;
import
ActivityCalendar
from
"@/components/ActivityCalendar"
;
import
Empty
from
"@/components/Empty"
;
import
Empty
from
"@/components/Empty"
;
...
@@ -125,8 +125,8 @@ const Timeline = () => {
...
@@ -125,8 +125,8 @@ const Timeline = () => {
<
TimelineSidebarDrawer
/>
<
TimelineSidebarDrawer
/>
</
MobileHeader
>
</
MobileHeader
>
)
}
)
}
<
div
className=
{
cl
assNames
(
"w-full flex flex-row justify-start items-start px-4 sm:px-6 gap-4"
)
}
>
<
div
className=
{
cl
sx
(
"w-full flex flex-row justify-start items-start px-4 sm:px-6 gap-4"
)
}
>
<
div
className=
{
cl
assNames
(
md
?
"w-[calc(100%-15rem)]"
:
"w-full"
)
}
>
<
div
className=
{
cl
sx
(
md
?
"w-[calc(100%-15rem)]"
:
"w-full"
)
}
>
<
div
className=
"w-full shadow flex flex-col justify-start items-start px-4 py-3 rounded-xl bg-white dark:bg-zinc-800 text-black dark:text-gray-300"
>
<
div
className=
"w-full shadow flex flex-col justify-start items-start px-4 py-3 rounded-xl bg-white dark:bg-zinc-800 text-black dark:text-gray-300"
>
<
div
className=
"relative w-full flex flex-row justify-between items-center"
>
<
div
className=
"relative w-full flex flex-row justify-between items-center"
>
<
div
>
<
div
>
...
@@ -149,9 +149,9 @@ const Timeline = () => {
...
@@ -149,9 +149,9 @@ const Timeline = () => {
{
groupedByMonth
.
map
((
group
,
index
)
=>
(
{
groupedByMonth
.
map
((
group
,
index
)
=>
(
<
Fragment
key=
{
group
.
month
}
>
<
Fragment
key=
{
group
.
month
}
>
<
div
className=
{
cl
assNames
(
"flex flex-col justify-start items-start w-full mt-2 last:mb-4"
)
}
>
<
div
className=
{
cl
sx
(
"flex flex-col justify-start items-start w-full mt-2 last:mb-4"
)
}
>
<
div
className=
{
cl
assNames
(
"flex shrink-0 flex-row w-full pl-1 mt-2 mb-2"
)
}
>
<
div
className=
{
cl
sx
(
"flex shrink-0 flex-row w-full pl-1 mt-2 mb-2"
)
}
>
<
div
className=
{
cl
assNames
(
"w-full flex flex-col"
)
}
>
<
div
className=
{
cl
sx
(
"w-full flex flex-col"
)
}
>
<
span
className=
"font-medium text-3xl leading-tight mb-1"
>
<
span
className=
"font-medium text-3xl leading-tight mb-1"
>
{
new
Date
(
group
.
month
).
toLocaleString
(
i18n
.
language
,
{
month
:
"short"
,
timeZone
:
"UTC"
})
}
{
new
Date
(
group
.
month
).
toLocaleString
(
i18n
.
language
,
{
month
:
"short"
,
timeZone
:
"UTC"
})
}
</
span
>
</
span
>
...
@@ -160,11 +160,11 @@ const Timeline = () => {
...
@@ -160,11 +160,11 @@ const Timeline = () => {
<
ActivityCalendar
month=
{
group
.
month
}
data=
{
group
.
data
}
onClick=
{
(
date
)
=>
setSelectedDay
(
date
)
}
/>
<
ActivityCalendar
month=
{
group
.
month
}
data=
{
group
.
data
}
onClick=
{
(
date
)
=>
setSelectedDay
(
date
)
}
/>
</
div
>
</
div
>
<
div
className=
{
cl
assNames
(
"w-full flex flex-col justify-start items-start"
)
}
>
<
div
className=
{
cl
sx
(
"w-full flex flex-col justify-start items-start"
)
}
>
{
group
.
memos
.
map
((
memo
,
index
)
=>
(
{
group
.
memos
.
map
((
memo
,
index
)
=>
(
<
div
<
div
key=
{
`${memo.name}-${memo.displayTime}`
}
key=
{
`${memo.name}-${memo.displayTime}`
}
className=
{
cl
assNames
(
"relative w-full flex flex-col justify-start items-start pl-4 sm:pl-10 pt-0"
)
}
className=
{
cl
sx
(
"relative w-full flex flex-col justify-start items-start pl-4 sm:pl-10 pt-0"
)
}
>
>
<
MemoView
className=
"!border max-w-full !border-gray-100 dark:!border-zinc-700"
memo=
{
memo
}
/>
<
MemoView
className=
"!border max-w-full !border-gray-100 dark:!border-zinc-700"
memo=
{
memo
}
/>
<
div
className=
"absolute -left-2 sm:left-2 top-4 h-full"
>
<
div
className=
"absolute -left-2 sm:left-2 top-4 h-full"
>
...
...
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