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
c189654c
Unverified
Commit
c189654c
authored
Mar 15, 2023
by
boojack
Committed by
GitHub
Mar 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update resource dashboard style (#1362)
parent
0a66c5c2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
61 deletions
+80
-61
ResourceCard.tsx
web/src/components/ResourceCard.tsx
+7
-10
ResourceCover.tsx
web/src/components/ResourceCover.tsx
+24
-1
ResourceSearchBar.tsx
web/src/components/ResourceSearchBar.tsx
+1
-1
resource-card.less
web/src/less/resource-card.less
+10
-10
resource-cover.less
web/src/less/resource-cover.less
+3
-3
ResourcesDashboard.tsx
web/src/pages/ResourcesDashboard.tsx
+35
-36
No files found.
web/src/components/ResourceCard.tsx
View file @
c189654c
...
...
@@ -75,18 +75,15 @@ const ResourceCard = ({ resource, handlecheckClick, handleUncheckClick }: Resour
return
(
<
div
className=
"resource-card"
>
<
div
className=
"
btns-container
"
>
<
div
className=
"
w-full p-2 flex flex-row justify-between items-center absolute top-0 left-0
"
>
<
div
onClick=
{
()
=>
handleSelectBtnClick
()
}
>
{
isSelected
?
(
<
Icon
.
CheckCircle2
className=
"m-2 text-gray-500 hover:text-black absolute top-1"
/>
)
:
(
<
Icon
.
Circle
className=
"resource-checkbox"
/>
)
}
{
isSelected
?
<
Icon
.
CheckCircle2
className=
"resource-checkbox !flex"
/>
:
<
Icon
.
Circle
className=
"resource-checkbox"
/>
}
</
div
>
<
Dropdown
className=
"more-action-btn"
actionsClassName=
"!w-28"
trigger=
{
<
Icon
.
MoreVertical
className=
"w-4 h-auto hover:opacity-80 cursor-pointer"
/>
}
actions=
{
<>
<
button
...
...
@@ -117,12 +114,12 @@ const ResourceCard = ({ resource, handlecheckClick, handleUncheckClick }: Resour
}
/>
</
div
>
<
div
className=
"
p-5
"
>
<
div
className=
"
w-full flex flex-row justify-center items-center pb-2 pt-4 px-2
"
>
<
ResourceCover
resource=
{
resource
}
/>
</
div
>
<
div
>
<
div
className=
"
text-base overflow-x-auto whitespace-nowrap text-center
"
>
{
resource
.
filename
}
</
div
>
<
div
className=
"text-
sm
text-gray-400 text-center"
>
{
dayjs
(
resource
.
createdTs
).
locale
(
"en"
).
format
(
"YYYY/MM/DD HH:mm:ss"
)
}
</
div
>
<
div
className=
"w-full flex flex-col justify-start items-center px-1 select-none"
>
<
div
className=
"
w-full text-base overflow-x-auto whitespace-nowrap text-center text-ellipsis truncate
"
>
{
resource
.
filename
}
</
div
>
<
div
className=
"text-
xs
text-gray-400 text-center"
>
{
dayjs
(
resource
.
createdTs
).
locale
(
"en"
).
format
(
"YYYY/MM/DD HH:mm:ss"
)
}
</
div
>
</
div
>
</
div
>
);
...
...
web/src/components/ResourceCover.tsx
View file @
c189654c
...
...
@@ -6,8 +6,31 @@ interface ResourceCoverProps {
resource
:
Resource
;
}
const
getResourceType
=
(
resource
:
Resource
)
=>
{
if
(
resource
.
type
.
startsWith
(
"image"
))
{
return
"image/*"
;
}
else
if
(
resource
.
type
.
startsWith
(
"video"
))
{
return
"video/*"
;
}
else
if
(
resource
.
type
.
startsWith
(
"audio"
))
{
return
"audio/*"
;
}
else
if
(
resource
.
type
.
startsWith
(
"text"
))
{
return
"text/*"
;
}
else
if
(
resource
.
type
.
startsWith
(
"application/epub+zip"
))
{
return
"application/epub+zip"
;
}
else
if
(
resource
.
type
.
startsWith
(
"application/pdf"
))
{
return
"application/pdf"
;
}
else
if
(
resource
.
type
.
startsWith
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
))
{
return
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
;
}
else
if
(
resource
.
type
.
startsWith
(
"application/msword"
))
{
return
"application/msword"
;
}
else
{
return
"application/octet-stream"
;
}
};
const
ResourceCover
=
({
resource
}:
ResourceCoverProps
)
=>
{
switch
(
resource
.
type
)
{
const
resourceType
=
getResourceType
(
resource
);
switch
(
resourceType
)
{
case
"image/*"
:
return
<
Icon
.
FileImage
className=
"resource-cover"
/>;
case
"video/*"
:
...
...
web/src/components/ResourceSearchBar.tsx
View file @
c189654c
...
...
@@ -23,7 +23,7 @@ const ResourceSearchBar = ({ setQuery }: ResourceSearchBarProps) => {
);
return
(
<
div
className=
"w-4
/1
2"
>
<
div
className=
"w-4
4 sm:w-5
2"
>
<
div
className=
"w-full h-9 flex flex-row justify-start items-center py-2 px-3 rounded-md bg-gray-200 dark:bg-zinc-800"
>
<
Icon
.
Search
className=
"w-4 h-auto opacity-30 dark:text-gray-200"
/>
<
input
...
...
web/src/less/resource-card.less
View file @
c189654c
.resource-card{
@apply
flex flex-col relative justify-start hover:bg-slate-200 dark:hover:bg-slate-600 w-full m-4
rounded-md;
.resource-card
{
@apply
w-full p-2 relative flex flex-col justify-start hover:shadow hover:bg-slate-200 dark:hover:bg-slate-600
rounded-md;
&:hover {
.resource-checkbox {
@apply flex
m-2 text-gray-500 absolute top-1
hover:text-black;
@apply flex hover:text-black;
}
.more-action-btn{
@apply flex
absolute right-0 top-1
;
.more-action-btn
{
@apply flex;
}
}
.resource-checkbox{
@apply hidden
hover:flex
;
.resource-checkbox
{
@apply hidden
w-4 h-auto cursor-pointer hover:flex
;
}
.more-action-btn{
@apply hidden
m-2
;
.more-action-btn
{
@apply hidden;
&:hover {
& + .more-action-btns-wrapper {
display: flex;
}
}
}
}
}
web/src/less/resource-cover.less
View file @
c189654c
.resource-cover{
@apply w-full h-full ml-auto mr-auto mt-5 opacity-60;
}
\ No newline at end of file
.resource-cover {
@apply w-20 h-auto ml-auto mr-auto opacity-40;
}
web/src/pages/ResourcesDashboard.tsx
View file @
c189654c
...
...
@@ -95,54 +95,53 @@ const ResourcesDashboard = () => {
};
return
(
<
section
className=
"w-full min-h-full flex flex-col justify-start items-center px-4 sm:px-2 sm:pt-4 pb-8 bg-zinc-100 dark:bg-zinc-800"
>
<
section
className=
"w-full m
ax-w-2xl m
in-h-full flex flex-col justify-start items-center px-4 sm:px-2 sm:pt-4 pb-8 bg-zinc-100 dark:bg-zinc-800"
>
<
MobileHeader
showSearch=
{
false
}
/>
<
div
className=
"w-full flex flex-col justify-start items-start px-4 py-3 rounded-xl bg-white dark:bg-zinc-700 text-black dark:text-gray-300"
>
<
div
className=
"relative w-full flex flex-row justify-between items-center"
>
<
p
className=
"
px-2 py-1
flex flex-row justify-start items-center select-none rounded"
>
<
p
className=
"flex flex-row justify-start items-center select-none rounded"
>
<
Icon
.
Paperclip
className=
"w-5 h-auto mr-1"
/>
{
t
(
"common.resources"
)
}
</
p
>
<
ResourceSearchBar
setQuery=
{
setQueryText
}
/>
</
div
>
<
div
className=
" flex flex-col justify-start items-start w-full"
>
<
div
className=
"w-full flex flex-row justify-end items-center"
>
<
div
className=
"flex flex-row justify-start items-center space-x-2"
></
div
>
<
div
className=
"m-2"
>
{
isVisiable
&&
(
<
Button
onClick=
{
()
=>
handleDeleteSelectedBtnClick
()
}
color=
"danger"
title=
{
t
(
"resources.delete-selected-resources"
)
}
>
<
Icon
.
Trash2
className=
"w-4 h-auto"
/>
</
Button
>
)
}
</
div
>
<
div
className=
"m-2"
>
<
Button
onClick=
{
()
=>
showCreateResourceDialog
({})
}
title=
{
t
(
"common.create"
)
}
>
<
Icon
.
Plus
className=
"w-4 h-auto"
/>
<
div
className=
"w-full flex flex-row justify-end items-center space-x-2 mt-3"
>
{
isVisiable
&&
(
<
Button
onClick=
{
()
=>
handleDeleteSelectedBtnClick
()
}
color=
"danger"
>
<
Icon
.
Trash2
className=
"w-4 h-auto"
/>
</
Button
>
)
}
<
Button
onClick=
{
()
=>
showCreateResourceDialog
({})
}
>
<
Icon
.
Plus
className=
"w-4 h-auto"
/>
</
Button
>
<
Dropdown
className=
"drop-shadow-none"
actionsClassName=
"!w-28 rounded-lg drop-shadow-md dark:bg-zinc-800"
positionClassName=
"mt-2 top-full right-0"
trigger=
{
<
Button
variant=
"outlined"
>
<
Icon
.
MoreVertical
className=
"w-4 h-auto"
/>
</
Button
>
</
div
>
<
Dropdown
className=
"drop-shadow-none m-2 "
actionsClassName=
"!w-28 rounded-lg drop-shadow-md dark:bg-zinc-800"
positionClassName=
"mt-2 top-full right-0"
actions=
{
<>
<
button
className=
"w-full content-center text-sm whitespace-nowrap leading-6 py-1 px-3 cursor-pointer rounded hover:bg-gray-100 dark:hover:bg-zinc-600"
onClick=
{
handleDeleteUnusedResourcesBtnClick
}
>
{
t
(
"resources.clear"
)
}
</
button
>
</>
}
/>
</
div
>
}
actions=
{
<>
<
button
className=
"w-full flex flex-row justify-start items-center content-center text-sm whitespace-nowrap leading-6 py-1 px-3 cursor-pointer rounded hover:bg-gray-100 dark:hover:bg-zinc-600"
onClick=
{
handleDeleteUnusedResourcesBtnClick
}
>
<
Icon
.
Trash2
className=
"w-4 h-auto mr-2"
/>
{
t
(
"resources.clear"
)
}
</
button
>
</>
}
/>
</
div
>
<
div
className=
"w-full flex flex-col justify-start items-start mt-4 mb-6"
>
{
loadingState
.
isLoading
?
(
<
div
className=
"
flex flex-col justify-center items-center w-full h-32
"
>
<
div
className=
"
w-full h-32 flex flex-col justify-center items-center
"
>
<
p
className=
"w-full text-center text-base my-6 mt-8"
>
{
t
(
"resources.fetching-data"
)
}
</
p
>
</
div
>
)
:
(
<
div
className=
"w-full h-full grid grid-cols-2
sm:grid-cols-3 md:grid-cols-6 gap-4
"
>
<
div
className=
"w-full h-full grid grid-cols-2
md:grid-cols-4 md:px-6 gap-6
"
>
{
resources
.
length
===
0
?
(
<
p
className=
"w-full text-center text-base my-6 mt-8"
>
{
t
(
"resources.no-resources"
)
}
</
p
>
)
:
(
...
...
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