Skip to content

Commit 58c872e

Browse files
committed
Updated cargo deps/rust version, fixed sqlite migrations and added album page
1 parent 7dacdf3 commit 58c872e

File tree

28 files changed

+3709
-1697
lines changed

28 files changed

+3709
-1697
lines changed

Cargo.lock

Lines changed: 3333 additions & 1490 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,64 +5,69 @@ members = [".", "migration"]
55
name = "backpack"
66
version = "0.1.0"
77
authors = ["Riku <[email protected]>"]
8-
edition = "2018"
8+
edition = "2021"
99

1010
[dependencies.sea-orm]
11-
version = "0.9"
12-
features = [
11+
version = "1.1.14"
12+
features = [
1313
"sqlx-sqlite",
1414
"sqlx-mysql",
1515
"sqlx-postgres",
1616
"runtime-tokio-rustls",
17-
"macros"
18-
]
17+
"macros",
18+
]
1919

2020
[dependencies]
2121
migration = { path = "migration" }
22-
tokio = { version = "1.10.0", features = ["full"] }
23-
clap = { version = "3.2.16", features = ["derive"] }
24-
serde = "1.0.126"
25-
sqlx = { version = "0.6.0", features = [ "runtime-tokio-rustls", "postgres", "chrono", "sqlite" ] }
26-
serde_json = { version = "1.0.64", features = [ "preserve_order" ] }
27-
jsonwebtoken = "8"
22+
tokio = { version = "1.14.1", features = ["full"] }
23+
clap = { version = "4.5.42", features = ["derive"] }
24+
serde = "1.0.219"
25+
sqlx = { version = "0.8.4", features = [
26+
"runtime-tokio-rustls",
27+
"postgres",
28+
"chrono",
29+
"sqlite",
30+
] }
31+
serde_json = { version = "1.0.142", features = ["preserve_order"] }
32+
jsonwebtoken = "9.3.1"
2833
dotenv = "0.15.0"
29-
actix-web = "4.0.1"
30-
actix-files = "0.6.0"
31-
actix-multipart = "0.4.0"
32-
actix-http = "3.0.4"
34+
actix-web = "4.11.0"
35+
actix-files = "0.6.6"
36+
actix-multipart = "0.7.2"
37+
actix-http = "3.11.0"
3338
utoipa = { version = "2.0.1", features = ["actix_extras"] }
34-
figlet-rs = "0.1.3"
35-
indicatif = "0.17.0"
36-
colored = "2.0.0"
37-
derive_more = "0.99.17"
38-
argon2 = { version = "0.4.0", features = ["std"] }
39+
figlet-rs = "0.1.5"
40+
indicatif = "0.18.0"
41+
colored = "3.0.0"
42+
derive_more = "2.0.1"
43+
argon2 = { version = "0.5.3", features = ["std"] }
3944
rusoto_s3 = "0.48.0"
4045
rusoto_core = "0.48.0"
41-
image = "0.24.0"
42-
anyhow = "1.0.53"
43-
log = "0.4.14"
44-
infer = "0.9.0"
45-
rand = "0.8.3"
46-
futures = "0.3.12"
47-
time = "0.3.9"
48-
chrono = "0.4"
49-
async-trait = "0.1.42"
50-
env_logger = "0.9.0"
51-
regex = "1"
52-
lettre = { version = "0.10.0-rc.6", features = [ "tokio1-native-tls" ] }
53-
thiserror = "1.0"
54-
lazy_static = "1.4.0"
46+
image = "0.25.6"
47+
anyhow = "1.0.98"
48+
log = "0.4.27"
49+
infer = "0.19.0"
50+
rand = "0.9.2"
51+
futures = "0.3.31"
52+
time = "0.3.41"
53+
chrono = "0.4.41"
54+
async-trait = "0.1.88"
55+
env_logger = "0.11.8"
56+
regex = "1.11.1"
57+
lettre = { version = "0.10.0-rc.6", features = ["tokio1-native-tls"] }
58+
thiserror = "2.0.12"
59+
lazy_static = "1.5.0"
5560
nanoid = "0.4.0"
56-
uuid = { version = "1", features = ["v4"] }
57-
sha2 = "0.10"
58-
bytes = "1.1.0"
59-
git-version = "0.3.5"
60-
actix-multipart-extract = "0.1.4"
61-
num_cpus = "1.0"
62-
heck = "0.4.0"
63-
oauth2 = "4.2.3"
64-
reqwest = { version = "0.11.11", features = [ "json" ] }
65-
moka = { version = "0.9.4", features = ["future"] }
66-
url = "2.3.1"
67-
actix-cors = "0.6"
68-
once_cell = "1.16.0"
61+
uuid = { version = "1.17.0", features = ["v4"] }
62+
sha2 = "0.10.9"
63+
bytes = "1.10.1"
64+
git-version = "0.3.9"
65+
actix-multipart-extract = "0.1.5"
66+
num_cpus = "1.17.0"
67+
heck = "0.5.0"
68+
oauth2 = "5.0.0"
69+
reqwest = { version = "0.12.22", features = ["json"] }
70+
moka = { version = "0.12.10", features = ["future"] }
71+
url = "2.5.4"
72+
actix-cors = "0.7.1"
73+
once_cell = "1.21.3"

frontend/assets/icons/folder.svg

Lines changed: 1 addition & 0 deletions
Loading

frontend/components/Header.tsx

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Router from "next/router"
66
import SunIcon from "/assets/icons/sun.svg"
77
import MoonIcon from "/assets/icons/moon.svg"
88
import UploadIcon from "/assets/icons/upload.svg"
9+
import FolderIcon from "/assets/icons/folder.svg"
910
import SettingsIcon from "/assets/icons/settings.svg"
1011
import LogOutIcon from "/assets/icons/log-out.svg"
1112
import KeyIcon from "/assets/icons/key.svg"
@@ -37,6 +38,12 @@ const NAV_ITEMS: NavItem[] = [
3738
icon: UploadIcon,
3839
to: "/user/uploads"
3940
},
41+
{
42+
label: 'Albums',
43+
subLabel: "Access your albums",
44+
icon: FolderIcon,
45+
to: "/user/album"
46+
},
4047
{
4148
label: "Settings",
4249
subLabel: "Account user settings",
@@ -77,7 +84,7 @@ const Header: React.FC = () => {
7784
</Button>
7885
) : (
7986
<Flex alignItems="center">
80-
<Menu matchWidth={true} autoSelect={false}>
87+
<Menu autoSelect={false}>
8188
<MenuButton
8289
as={Button}
8390
rounded="full"
@@ -89,23 +96,23 @@ const Header: React.FC = () => {
8996
</MenuButton>
9097

9198
<MenuList>
92-
{NAV_ITEMS.map(item => <MenuItem
93-
key={item.label}
94-
icon={<Icon as={item.icon} color="gray.400" fontSize="md" mt="5px"/>}
99+
{NAV_ITEMS.map(item => <MenuItem
100+
key={item.label}
101+
icon={<Icon as={item.icon} color="gray.400" fontSize="md" mt="5px" />}
95102
onClick={() => Router.push(item.to)}>
96-
{item.label}
97-
</MenuItem>)}
103+
{item.label}
104+
</MenuItem>)}
98105

99-
<MenuDivider/>
106+
<MenuDivider />
100107

101108
<MenuItem icon={<Icon
102-
as={LogOutIcon}
103-
color="gray.400"
104-
fontSize="md"
105-
mt="5px"/>}
109+
as={LogOutIcon}
110+
color="gray.400"
111+
fontSize="md"
112+
mt="5px" />}
106113
onClick={onLogout}>
107-
Logout
108-
</MenuItem>
114+
Logout
115+
</MenuItem>
109116
</MenuList>
110117
</Menu>
111118
</Flex>
@@ -137,9 +144,9 @@ const Header: React.FC = () => {
137144
spacing={6}
138145
>
139146
<Button onClick={toggleColorMode} variant="ghost">
140-
{colorMode === "light" ? <Icon as={MoonIcon} /> : <Icon as={SunIcon} />}
147+
{colorMode === "light" ? <Icon as={MoonIcon} /> : <Icon as={SunIcon} />}
141148
</Button>
142-
<User/>
149+
<User />
143150
</Stack>
144151
</Flex>
145152
</Box>
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
import * as React from "react"
2+
3+
import { convertBytes } from "helpers/util"
4+
import { Icon } from "@chakra-ui/icons"
5+
import { FileSearch } from "components/FileSearch"
6+
import { Page } from "layouts/Page"
7+
import Router from "next/router"
8+
import PlusIcon from "assets/icons/plus.svg"
9+
import { Authenticated } from "components/Authenticated"
10+
import {
11+
Box,
12+
Divider,
13+
Flex,
14+
Heading,
15+
Text,
16+
Stack,
17+
Stat,
18+
StatLabel,
19+
StatNumber,
20+
ToastId,
21+
useToast,
22+
Button,
23+
useDisclosure,
24+
Modal,
25+
ModalOverlay,
26+
ModalContent,
27+
ModalHeader,
28+
ModalCloseButton,
29+
ModalBody,
30+
FormControl,
31+
FormLabel,
32+
Input,
33+
ModalFooter,
34+
Checkbox
35+
} from "@chakra-ui/react"
36+
import api from "helpers/api"
37+
import { useForm } from "react-hook-form"
38+
39+
const Albums: React.FC = () => {
40+
const toast = useToast()
41+
const { isOpen, onOpen, onClose } = useDisclosure()
42+
const albumForm = useForm()
43+
44+
return <Authenticated>
45+
<Page title="Albums">
46+
<Flex mt="7em" justify="center">
47+
<Box w={{ base: "90vw", md: "70vw" }} maxW="1200px">
48+
<Stack spacing={4}>
49+
<Heading>Albums</Heading>
50+
<Text as="h2" fontSize="sm" color="gray.400">
51+
Create albums to share with others
52+
</Text>
53+
54+
<Button
55+
onClick={onOpen}
56+
bg="primary.500"
57+
_hover={{
58+
bg: "primary.600"
59+
}}
60+
color="white"
61+
position="fixed"
62+
bottom="3em"
63+
right="3em"
64+
borderRadius="50px"
65+
w="60px"
66+
h="60px"
67+
zIndex={4}>
68+
<Icon w={5} h={5} as={PlusIcon} />
69+
</Button>
70+
<Modal isOpen={isOpen} onClose={onClose}>
71+
<ModalOverlay />
72+
<ModalContent>
73+
<form onSubmit={albumForm.handleSubmit((data) => console.log(data))}>
74+
<ModalHeader>Create Album</ModalHeader>
75+
<ModalCloseButton />
76+
<ModalBody >
77+
<FormControl>
78+
<FormLabel>Name</FormLabel>
79+
<Input
80+
placeholder={"Album Name"}
81+
{...albumForm.register("name")}
82+
/>
83+
</FormControl>
84+
<FormControl mt={3}>
85+
<FormLabel>Description</FormLabel>
86+
<Input
87+
placeholder={"Album Description"}
88+
{...albumForm.register("description")}
89+
/>
90+
91+
</FormControl>
92+
<FormControl mt={3}>
93+
<Checkbox {...albumForm.register("public")}>Public</Checkbox>
94+
</FormControl>
95+
</ModalBody>
96+
<ModalFooter>
97+
<Button variant='ghost' mr={3} onClick={onClose}>
98+
Cancel
99+
</Button>
100+
<Button colorScheme="primary" type="submit">Create</Button>
101+
</ModalFooter>
102+
</form>
103+
</ModalContent>
104+
</Modal>
105+
</Stack>
106+
</Box>
107+
</Flex>
108+
{/* <Flex mt="7em" minH="100vh" justify="center" mb={5}>
109+
<Box w={{ base: "90vw", md: "70vw" }} maxW="1200px">
110+
<Stack spacing={4}>
111+
<Heading>Uploads</Heading>
112+
<input type="file" ref={shadowUploader} onChange={uploadCallback} style={{ display: "none" }} multiple />
113+
<Button
114+
onClick={uploadButtonCallback}
115+
bg="primary.500"
116+
_hover={{
117+
bg: "primary.600"
118+
}}
119+
color="white"
120+
position="fixed"
121+
bottom="3em"
122+
right="3em"
123+
borderRadius="50px"
124+
w="60px"
125+
h="60px"
126+
zIndex={4}>
127+
<Icon w={5} h={5} as={UploadIcon} />
128+
</Button>
129+
<Divider />
130+
<Box>
131+
<Stat>
132+
<StatLabel>Usage</StatLabel>
133+
<StatNumber>{usage}</StatNumber>
134+
</Stat>
135+
</Box>
136+
<Divider />
137+
<FileSearch
138+
key={searchReload}
139+
onSearch={(page, query) => api.upload.list(page.toString(), "@me", query)}
140+
onDelete={deleteCallback}
141+
onFileDetails={fileId => Router.push(`/user/uploads/${fileId}`)} />
142+
</Stack>
143+
</Box>
144+
</Flex> */}
145+
</Page>
146+
</Authenticated >
147+
}
148+
149+
export default Albums

frontend/pages/user/tokens.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ const Tokens: NextPage = () => {
143143

144144
// Initial load page 1.
145145
React.useEffect(() => {
146-
console.log("hi")
147146
getApplicationPage(1)
148147
}, [])
149148

@@ -173,7 +172,7 @@ const Tokens: NextPage = () => {
173172
h="60px"
174173
zIndex={4}>
175174
<Icon w={5} h={5} as={PlusIcon} />
176-
</Button>
175+
</Button>
177176
<Modal isOpen={isOpen} onClose={closeForm}>
178177
<ModalOverlay />
179178
<ModalContent>
@@ -199,7 +198,7 @@ const Tokens: NextPage = () => {
199198
</ModalContent>
200199
</Modal>
201200
<Divider />
202-
{ applications !== null ? <DataList>
201+
{applications !== null ? <DataList>
203202
<DataListHeader>
204203
<DataListCell
205204
colName="name"
@@ -254,13 +253,13 @@ const Tokens: NextPage = () => {
254253
))}
255254
</DataList> : <DataList>
256255
<Center h="9rem">
257-
{loadingTokens ? <Spinner size="lg"/> : <VStack color="gray.500">
258-
<Icon as={KeyIcon} w="30px" h="30px"/>
256+
{loadingTokens ? <Spinner size="lg" /> : <VStack color="gray.500">
257+
<Icon as={KeyIcon} w="30px" h="30px" />
259258
<Heading as="h2" size="2lg">
260259
No Tokens found. <Link color="primary.400" onClick={onOpen}>Create one</Link>
261260
</Heading>
262261
</VStack>}
263-
</Center>
262+
</Center>
264263
</DataList>}
265264
{applications && (
266265
<Flex justifyContent="center" mt={5}>

0 commit comments

Comments
 (0)