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
893dd2c8
Commit
893dd2c8
authored
Jan 18, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add disable filter to renderer context
parent
d426f89c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
12 deletions
+24
-12
Tag.tsx
web/src/components/MemoContent/Tag.tsx
+9
-2
index.tsx
web/src/components/MemoContent/index.tsx
+2
-0
context.ts
web/src/components/MemoContent/types/context.ts
+1
-0
MemoView.tsx
web/src/components/MemoView.tsx
+9
-7
ShareMemoDialog.tsx
web/src/components/ShareMemoDialog.tsx
+1
-1
Home.tsx
web/src/pages/Home.tsx
+1
-1
UserProfile.tsx
web/src/pages/UserProfile.tsx
+1
-1
No files found.
web/src/components/MemoContent/Tag.tsx
View file @
893dd2c8
import
classNames
from
"classnames"
;
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"
;
...
@@ -11,7 +12,7 @@ const Tag: React.FC<Props> = ({ content }: Props) => {
...
@@ -11,7 +12,7 @@ const Tag: React.FC<Props> = ({ content }: Props) => {
const
filterStore
=
useFilterStore
();
const
filterStore
=
useFilterStore
();
const
handleTagClick
=
()
=>
{
const
handleTagClick
=
()
=>
{
if
(
context
.
readonly
)
{
if
(
context
.
disableFilter
)
{
return
;
return
;
}
}
...
@@ -24,7 +25,13 @@ const Tag: React.FC<Props> = ({ content }: Props) => {
...
@@ -24,7 +25,13 @@ const Tag: React.FC<Props> = ({ content }: Props) => {
};
};
return
(
return
(
<
span
className=
"cursor-pointer inline-block w-auto text-blue-600 dark:text-blue-400 hover:opacity-80"
onClick=
{
handleTagClick
}
>
<
span
className=
{
classNames
(
"inline-block w-auto text-blue-600 dark:text-blue-400"
,
context
.
disableFilter
?
""
:
"cursor-pointer hover:opacity-80"
)
}
onClick=
{
handleTagClick
}
>
#
{
content
}
#
{
content
}
</
span
>
</
span
>
);
);
...
...
web/src/components/MemoContent/index.tsx
View file @
893dd2c8
...
@@ -9,6 +9,7 @@ interface Props {
...
@@ -9,6 +9,7 @@ interface Props {
nodes
:
Node
[];
nodes
:
Node
[];
memoId
?:
number
;
memoId
?:
number
;
readonly
?:
boolean
;
readonly
?:
boolean
;
disableFilter
?:
boolean
;
className
?:
string
;
className
?:
string
;
onClick
?:
(
e
:
React
.
MouseEvent
)
=>
void
;
onClick
?:
(
e
:
React
.
MouseEvent
)
=>
void
;
}
}
...
@@ -35,6 +36,7 @@ const MemoContent: React.FC<Props> = (props: Props) => {
...
@@ -35,6 +36,7 @@ const MemoContent: React.FC<Props> = (props: Props) => {
nodes
,
nodes
,
memoId
,
memoId
,
readonly
:
!
allowEdit
,
readonly
:
!
allowEdit
,
disableFilter
:
props
.
disableFilter
,
}
}
}
}
>
>
<
div
className=
{
`w-full flex flex-col justify-start items-start text-gray-800 dark:text-gray-300 ${className || ""}`
}
>
<
div
className=
{
`w-full flex flex-col justify-start items-start text-gray-800 dark:text-gray-300 ${className || ""}`
}
>
...
...
web/src/components/MemoContent/types/context.ts
View file @
893dd2c8
...
@@ -5,6 +5,7 @@ interface Context {
...
@@ -5,6 +5,7 @@ interface Context {
nodes
:
Node
[];
nodes
:
Node
[];
memoId
?:
number
;
memoId
?:
number
;
readonly
?:
boolean
;
readonly
?:
boolean
;
disableFilter
?:
boolean
;
}
}
export
const
RendererContext
=
createContext
<
Context
>
({
export
const
RendererContext
=
createContext
<
Context
>
({
...
...
web/src/components/MemoView.tsx
View file @
893dd2c8
...
@@ -32,7 +32,7 @@ interface Props {
...
@@ -32,7 +32,7 @@ interface Props {
memo
:
Memo
;
memo
:
Memo
;
showCreator
?:
boolean
;
showCreator
?:
boolean
;
showVisibility
?:
boolean
;
showVisibility
?:
boolean
;
showPinned
Style
?:
boolean
;
showPinned
?:
boolean
;
className
?:
string
;
className
?:
string
;
}
}
...
@@ -166,7 +166,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
...
@@ -166,7 +166,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
return
(
return
(
<
div
<
div
className=
{
classNames
(
"group memo-wrapper"
,
"memos-"
+
memo
.
id
,
memo
.
pinned
&&
props
.
showPinned
Style
?
"pinned"
:
""
,
className
)
}
className=
{
classNames
(
"group memo-wrapper"
,
"memos-"
+
memo
.
id
,
memo
.
pinned
&&
props
.
showPinned
?
"pinned"
:
""
,
className
)
}
ref=
{
memoContainerRef
}
ref=
{
memoContainerRef
}
>
>
<
div
className=
"memo-top-wrapper mb-1"
>
<
div
className=
"memo-top-wrapper mb-1"
>
...
@@ -189,7 +189,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
...
@@ -189,7 +189,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
<
span
className=
"text-sm text-gray-400 select-none"
onClick=
{
handleGotoMemoDetailPage
}
>
<
span
className=
"text-sm text-gray-400 select-none"
onClick=
{
handleGotoMemoDetailPage
}
>
{
displayTime
}
{
displayTime
}
</
span
>
</
span
>
{
props
.
showPinned
Style
&&
memo
.
pinned
&&
(
{
props
.
showPinned
&&
memo
.
pinned
&&
(
<>
<>
<
Icon
.
Dot
className=
"w-4 h-auto text-gray-400 dark:text-zinc-400"
/>
<
Icon
.
Dot
className=
"w-4 h-auto text-gray-400 dark:text-zinc-400"
/>
<
Tooltip
title=
{
"Pinned"
}
placement=
"top"
>
<
Tooltip
title=
{
"Pinned"
}
placement=
"top"
>
...
@@ -217,10 +217,12 @@ const MemoView: React.FC<Props> = (props: Props) => {
...
@@ -217,10 +217,12 @@ const MemoView: React.FC<Props> = (props: Props) => {
</
span
>
</
span
>
<
div
className=
"more-action-btns-wrapper"
>
<
div
className=
"more-action-btns-wrapper"
>
<
div
className=
"more-action-btns-container min-w-[6em]"
>
<
div
className=
"more-action-btns-container min-w-[6em]"
>
<
span
className=
"btn"
onClick=
{
handleTogglePinMemoBtnClick
}
>
{
props
.
showPinned
&&
(
{
memo
.
pinned
?
<
Icon
.
BookmarkMinus
className=
"w-4 h-auto mr-2"
/>
:
<
Icon
.
BookmarkPlus
className=
"w-4 h-auto mr-2"
/>
}
<
span
className=
"btn"
onClick=
{
handleTogglePinMemoBtnClick
}
>
{
memo
.
pinned
?
t
(
"common.unpin"
)
:
t
(
"common.pin"
)
}
{
memo
.
pinned
?
<
Icon
.
BookmarkMinus
className=
"w-4 h-auto mr-2"
/>
:
<
Icon
.
BookmarkPlus
className=
"w-4 h-auto mr-2"
/>
}
</
span
>
{
memo
.
pinned
?
t
(
"common.unpin"
)
:
t
(
"common.pin"
)
}
</
span
>
)
}
<
span
className=
"btn"
onClick=
{
handleEditMemoClick
}
>
<
span
className=
"btn"
onClick=
{
handleEditMemoClick
}
>
<
Icon
.
Edit3
className=
"w-4 h-auto mr-2"
/>
<
Icon
.
Edit3
className=
"w-4 h-auto mr-2"
/>
{
t
(
"common.edit"
)
}
{
t
(
"common.edit"
)
}
...
...
web/src/components/ShareMemoDialog.tsx
View file @
893dd2c8
...
@@ -112,7 +112,7 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {
...
@@ -112,7 +112,7 @@ const ShareMemoDialog: React.FC<Props> = (props: Props) => {
>
>
<
span
className=
"w-full px-6 pt-5 pb-2 text-sm text-gray-500"
>
{
getDateTimeString
(
memo
.
displayTime
)
}
</
span
>
<
span
className=
"w-full px-6 pt-5 pb-2 text-sm text-gray-500"
>
{
getDateTimeString
(
memo
.
displayTime
)
}
</
span
>
<
div
className=
"w-full px-6 text-base pb-4"
>
<
div
className=
"w-full px-6 text-base pb-4"
>
<
MemoContent
memoId=
{
memo
.
id
}
nodes=
{
memo
.
nodes
}
readonly=
{
true
}
/>
<
MemoContent
memoId=
{
memo
.
id
}
nodes=
{
memo
.
nodes
}
readonly=
{
true
}
disableFilter
/>
<
MemoResourceListView
resourceList=
{
memo
.
resources
}
/>
<
MemoResourceListView
resourceList=
{
memo
.
resources
}
/>
</
div
>
</
div
>
<
div
className=
"flex flex-row justify-between items-center w-full bg-gray-100 dark:bg-zinc-900 py-4 px-6"
>
<
div
className=
"flex flex-row justify-between items-center w-full bg-gray-100 dark:bg-zinc-900 py-4 px-6"
>
...
...
web/src/pages/Home.tsx
View file @
893dd2c8
...
@@ -73,7 +73,7 @@ const Home = () => {
...
@@ -73,7 +73,7 @@ const Home = () => {
<
div
className=
"flex flex-col justify-start items-start w-full max-w-full pb-28"
>
<
div
className=
"flex flex-col justify-start items-start w-full max-w-full pb-28"
>
<
MemoFilter
className=
"px-2 pb-2"
/>
<
MemoFilter
className=
"px-2 pb-2"
/>
{
sortedMemos
.
map
((
memo
)
=>
(
{
sortedMemos
.
map
((
memo
)
=>
(
<
MemoView
key=
{
`${memo.id}-${memo.updateTime}`
}
memo=
{
memo
}
showVisibility
showPinned
Style
/>
<
MemoView
key=
{
`${memo.id}-${memo.updateTime}`
}
memo=
{
memo
}
showVisibility
showPinned
/>
))
}
))
}
{
isRequesting
?
(
{
isRequesting
?
(
<
div
className=
"flex flex-col justify-start items-center w-full my-4"
>
<
div
className=
"flex flex-col justify-start items-center w-full my-4"
>
...
...
web/src/pages/UserProfile.tsx
View file @
893dd2c8
...
@@ -107,7 +107,7 @@ const UserProfile = () => {
...
@@ -107,7 +107,7 @@ const UserProfile = () => {
</
div
>
</
div
>
<
MemoFilter
className=
"px-2 pb-3"
/>
<
MemoFilter
className=
"px-2 pb-3"
/>
{
sortedMemos
.
map
((
memo
)
=>
(
{
sortedMemos
.
map
((
memo
)
=>
(
<
MemoView
key=
{
memo
.
id
}
memo=
{
memo
}
showVisibility
showPinned
Style
/>
<
MemoView
key=
{
memo
.
id
}
memo=
{
memo
}
showVisibility
showPinned
/>
))
}
))
}
{
isRequesting
?
(
{
isRequesting
?
(
<
div
className=
"flex flex-col justify-start items-center w-full my-4"
>
<
div
className=
"flex flex-col justify-start items-center w-full my-4"
>
...
...
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