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
42d849ab
Unverified
Commit
42d849ab
authored
Feb 22, 2023
by
boojack
Committed by
GitHub
Feb 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update explore header style (#1137)
parent
d1b307b1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
46 deletions
+36
-46
system.go
server/system.go
+1
-1
system_setting.go
store/system_setting.go
+4
-2
MemoEditor.tsx
web/src/components/MemoEditor.tsx
+0
-11
explore.less
web/src/less/explore.less
+2
-8
memo-content.less
web/src/less/memo-content.less
+4
-4
Explore.tsx
web/src/pages/Explore.tsx
+25
-20
No files found.
server/system.go
View file @
42d849ab
...
...
@@ -66,7 +66,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
var
value
interface
{}
err
:=
json
.
Unmarshal
([]
byte
(
systemSetting
.
Value
),
&
value
)
if
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to unmarshal system setting"
)
.
SetInternal
(
err
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to unmarshal system setting
value
"
)
.
SetInternal
(
err
)
}
if
systemSetting
.
Name
==
api
.
SystemSettingAllowSignUpName
{
...
...
store/system_setting.go
View file @
42d849ab
...
...
@@ -114,12 +114,14 @@ func upsertSystemSetting(ctx context.Context, tx *sql.Tx, upsert *api.SystemSett
func
findSystemSettingList
(
ctx
context
.
Context
,
tx
*
sql
.
Tx
,
find
*
api
.
SystemSettingFind
)
([]
*
systemSettingRaw
,
error
)
{
where
,
args
:=
[]
string
{
"1 = 1"
},
[]
interface
{}{}
where
,
args
=
append
(
where
,
"name = ?"
),
append
(
args
,
find
.
Name
.
String
())
if
find
.
Name
.
String
()
!=
""
{
where
,
args
=
append
(
where
,
"name = ?"
),
append
(
args
,
find
.
Name
.
String
())
}
query
:=
`
SELECT
name,
value,
value,
description
FROM system_setting
WHERE `
+
strings
.
Join
(
where
,
" AND "
)
...
...
web/src/components/MemoEditor.tsx
View file @
42d849ab
...
...
@@ -257,15 +257,6 @@ const MemoEditor = () => {
}
};
const
scrollToEditingMemo
=
useCallback
(()
=>
{
if
(
editorState
.
editMemoId
)
{
const
memoElements
=
document
.
getElementsByClassName
(
`memos-
${
editorState
.
editMemoId
}
`
);
if
(
memoElements
.
length
!==
0
)
{
memoElements
[
0
].
scrollIntoView
({
behavior
:
"smooth"
});
}
}
},
[
editorState
.
editMemoId
]);
const
handleSaveBtnClick
=
async
()
=>
{
if
(
state
.
isRequesting
)
{
return
;
...
...
@@ -327,7 +318,6 @@ const MemoEditor = () => {
editorStore
.
clearResourceList
();
setEditorContentCache
(
""
);
editorRef
.
current
?.
setContent
(
""
);
scrollToEditingMemo
();
};
const
handleCancelEdit
=
()
=>
{
...
...
@@ -336,7 +326,6 @@ const MemoEditor = () => {
editorStore
.
clearResourceList
();
editorRef
.
current
?.
setContent
(
""
);
setEditorContentCache
(
""
);
scrollToEditingMemo
();
}
};
...
...
web/src/less/explore.less
View file @
42d849ab
...
...
@@ -11,17 +11,11 @@
@apply flex flex-row justify-start items-center;
> .logo-img {
@apply h-12
sm:h-14 w-auto
mr-2;
@apply h-12
w-auto rounded-md
mr-2;
}
> .title-text {
@apply text-xl sm:text-4xl font-mono text-gray-700 dark:text-gray-200;
}
}
> .action-button-container {
> .link-btn {
@apply block text-gray-600 dark:text-gray-200 dark:border-gray-600 font-mono text-base py-1 border px-3 leading-8 rounded-xl hover:opacity-80;
@apply text-xl sm:text-4xl text-gray-700 dark:text-gray-200;
}
}
}
...
...
web/src/less/memo-content.less
View file @
42d849ab
...
...
@@ -34,7 +34,7 @@
}
.tag-span {
@apply inline-block w-auto
font-mono
text-blue-600 dark:text-blue-400 cursor-pointer;
@apply inline-block w-auto text-blue-600 dark:text-blue-400 cursor-pointer;
}
.link {
...
...
@@ -70,13 +70,13 @@
@apply block;
}
&:hover{
.codeblock-copy-btn{
&:hover
{
.codeblock-copy-btn
{
@apply flex;
}
}
.codeblock-copy-btn{
.codeblock-copy-btn
{
@apply btn-normal absolute hidden top-2 right-2 border-solid border-2;
}
}
...
...
web/src/pages/Explore.tsx
View file @
42d849ab
import
dayjs
from
"dayjs"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
Link
}
from
"react-router-dom"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
{
useGlobalStore
,
useLocationStore
,
useMemoStore
,
useUserStore
}
from
"../store/module"
;
import
{
DEFAULT_MEMO_LIMIT
}
from
"../helpers/consts"
;
import
useLoading
from
"../hooks/useLoading"
;
...
...
@@ -19,6 +19,7 @@ interface State {
const
Explore
=
()
=>
{
const
{
t
,
i18n
}
=
useTranslation
();
const
navigate
=
useNavigate
();
const
globalStore
=
useGlobalStore
();
const
locationStore
=
useLocationStore
();
const
userStore
=
useUserStore
();
...
...
@@ -72,11 +73,11 @@ const Explore = () => {
})
:
state
.
memos
;
const
memoSort
=
(
mi
:
Memo
,
mj
:
Memo
)
=>
{
return
mj
.
displayTs
-
mi
.
displayTs
;
};
shownMemos
.
sort
(
memoSort
)
;
const
sortedMemos
=
shownMemos
.
filter
((
m
)
=>
m
.
rowStatus
===
"NORMAL"
);
const
sortedMemos
=
shownMemos
.
filter
((
m
)
=>
m
.
rowStatus
===
"NORMAL"
)
.
sort
((
mi
:
Memo
,
mj
:
Memo
)
=>
{
return
mj
.
displayTs
-
mi
.
displayTs
;
}
);
const
handleFetchMoreClick
=
async
()
=>
{
try
{
...
...
@@ -109,27 +110,31 @@ const Explore = () => {
}
};
const
handleTitleClick
=
()
=>
{
if
(
user
)
{
navigate
(
"/"
);
}
else
{
navigate
(
"/auth"
);
}
};
return
(
<
section
className=
"page-wrapper explore"
>
<
div
className=
"page-container"
>
<
div
className=
"page-header"
>
<
div
className=
"title-container
"
>
<
div
className=
"title-container
cursor-pointer hover:opacity-80"
onClick=
{
handleTitleClick
}
>
<
img
className=
"logo-img"
src=
{
customizedProfile
.
logoUrl
}
alt=
""
/>
<
span
className=
"title-text"
>
{
customizedProfile
.
name
}
</
span
>
<
a
className=
"dark:text-white ml-1 mt-1"
href=
"/explore/rss.xml"
target=
"_blank"
rel=
"noreferrer"
>
<
Icon
.
Rss
className=
"w-6 h-auto opacity-40 hover:opacity-60"
/>
</
a
>
</
div
>
<
div
className=
"action-button-container"
>
{
!
loadingState
.
isLoading
&&
user
?
(
<
Link
to=
"/"
className=
"link-btn btn-normal"
>
<
span
>
🏠
</
span
>
{
t
(
"common.back-to-home"
)
}
</
Link
>
)
:
(
<
Link
to=
"/auth"
className=
"link-btn btn-normal"
>
<
span
>
👉
</
span
>
{
t
(
"common.sign-in"
)
}
</
Link
>
)
}
<
div
className=
"flex flex-row justify-end items-center"
>
<
a
className=
"flex flex-row justify-center items-center h-12 w-12 border rounded-full hover:opacity-80 hover:shadow dark:text-white "
href=
"/explore/rss.xml"
target=
"_blank"
rel=
"noreferrer"
>
<
Icon
.
Rss
className=
"w-7 h-auto opacity-60"
/>
</
a
>
</
div
>
</
div
>
{
!
loadingState
.
isLoading
&&
(
...
...
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