Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a94eb08

Browse files
[feat]: Initiated a new project version 0.0
0 parents commit a94eb08

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+8314
-0
lines changed

‎.eslintrc.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

‎.gitignore‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env*.local
29+
# Environment Variables
30+
.env*
31+
32+
# vercel
33+
.vercel
34+
35+
# typescript
36+
*.tsbuildinfo
37+
next-env.d.ts

‎README.md‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<div align="center">
2+
3+
![Alt text](public/apple-touch-icon.png)
4+
5+
[StashBlob]()
6+
7+
Upload. Optimize. Share
8+
9+
10+
[Documentation]() [Changelog]()
11+
12+
</div>
13+
14+
## StashBlob
15+
16+
StashBlob is a cloud storage provider that gives user controls over thier own files to upload and share files faster.
17+
18+
## Upload
19+
20+
We allow you to upload files faster and easier. With our simple and fast upload stream, we give you a fast uploading experience throught the app.
21+
22+
## Optimize
23+
24+
Optimization is built into images, which means every image you upload, we would optimize them for you. So a slightly blury images would be optimized by 50-100%.
25+
26+
## Share
27+
28+
For every files you upload, we have the power to share them with your friends and beyond.
29+
30+
## Contributing
31+
32+
You feel eager to contribute on this? Seek our [Contributing Guidelines]() for more details.
33+
34+
35+
## Reference
36+
37+
- [Code of Conduct]()
38+
- [Contributing Guidelines]()
39+
- [MIT License]()

‎components.json‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "default",
4+
"rsc": false,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "tailwind.config.ts",
8+
"css": "styles/global.css",
9+
"baseColor": "zinc",
10+
"cssVariables": true
11+
},
12+
"aliases": {
13+
"components": "@/components",
14+
"utils": "@/lib/utils"
15+
}
16+
}

‎components/app/Loader.tsx‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
import { MagnifyingGlass } from "react-loader-spinner";
3+
export default function Loader() {
4+
return (
5+
<div className="flex items-center justify-center">
6+
<MagnifyingGlass
7+
visible={true}
8+
height="80"
9+
width="80"
10+
ariaLabel="MagnifyingGlass-loading"
11+
wrapperStyle={{}}
12+
wrapperClass="MagnifyingGlass-wrapper"
13+
glassColor="#c0efff"
14+
color="#2559c0"
15+
/>
16+
</div>
17+
);
18+
}

‎components/app/command-bx.tsx‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import {
2+
CommandDialog,
3+
CommandEmpty,
4+
CommandGroup,
5+
CommandInput,
6+
CommandItem,
7+
CommandList,
8+
CommandSeparator,
9+
CommandShortcut,
10+
} from "@/components/ui/command";
11+
import { Dispatch, SetStateAction } from "react";
12+
import Link from "next/link";
13+
14+
type CommandProp = {
15+
open: boolean;
16+
setOpen: Dispatch<SetStateAction<boolean>>;
17+
};
18+
19+
export function CommandBx({ open, setOpen }: CommandProp) {
20+
return (
21+
<>
22+
<CommandDialog open={open} onOpenChange={setOpen}>
23+
<CommandInput
24+
placeholder="Type a command or search..."
25+
className="text-white"
26+
/>
27+
<CommandList>
28+
<CommandEmpty className="text-white p-4 flex items-center justify-center">
29+
No results found.
30+
</CommandEmpty>
31+
<CommandGroup heading="Suggestions" className="text-white/50">
32+
<Link href="/settings/2FA">
33+
<CommandItem>
34+
<span className="text-white text-base">Enable 2FA</span>
35+
</CommandItem>
36+
</Link>
37+
</CommandGroup>
38+
<CommandSeparator />
39+
<CommandGroup heading="App" className="text-white/50">
40+
<Link href="/profifle">
41+
<CommandItem>
42+
<span className="text-white text-base">Profile</span>
43+
<CommandShortcut>⌘P</CommandShortcut>
44+
</CommandItem>
45+
</Link>
46+
<Link href="/billing">
47+
<CommandItem>
48+
<span className="text-white text-base">Billing</span>
49+
<CommandShortcut>⌘B</CommandShortcut>
50+
</CommandItem>
51+
</Link>
52+
<Link href="/settings">
53+
<CommandItem>
54+
<span className="text-white text-base">Settings</span>
55+
<CommandShortcut>⌘S</CommandShortcut>
56+
</CommandItem>
57+
</Link>
58+
</CommandGroup>
59+
</CommandList>
60+
</CommandDialog>
61+
</>
62+
);
63+
}

‎components/studio/Files.tsx‎

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
import { useRouter } from "next/router";
2+
import axios from "axios";
3+
import {
4+
Table,
5+
TableBody,
6+
TableCaption,
7+
TableCell,
8+
TableHead,
9+
TableHeader,
10+
TableRow,
11+
} from "@/components/ui/table";
12+
13+
import {
14+
DropdownMenu,
15+
DropdownMenuTrigger,
16+
DropdownMenuContent,
17+
DropdownMenuItem,
18+
} from "@radix-ui/react-dropdown-menu";
19+
20+
import Loader from "@/components/app/Loader";
21+
22+
import { MoreHorizontal, Forward, Trash2 } from "lucide-react";
23+
24+
import { useUser } from "@clerk/nextjs";
25+
import { useToast } from "../ui/use-toast";
26+
import { Dispatch, SetStateAction } from "react";
27+
28+
type typeFile = {
29+
date: string;
30+
filename: string;
31+
filesize: number;
32+
filetype: number;
33+
uploadID: string;
34+
username: string;
35+
};
36+
37+
type FileProp = {
38+
files: never[];
39+
dataLoading: boolean;
40+
fetchFiles(): Promise<void>;
41+
setShow: Dispatch<SetStateAction<boolean>>;
42+
};
43+
44+
export default function Files({
45+
files,
46+
dataLoading,
47+
fetchFiles,
48+
setShow,
49+
}: FileProp) {
50+
const { toast } = useToast();
51+
const { isSignedIn, user } = useUser();
52+
const router = useRouter();
53+
54+
const deleteFile = async (filename: string, uploadID: string) => {
55+
if (isSignedIn) {
56+
const id = user.id;
57+
axios
58+
.delete(`http://localhost:8080/delete/${filename}/${uploadID}`, {
59+
headers: {
60+
"Content-Type": "application/json",
61+
apikey: process.env.NEXT_PUBLIC_API_KEY,
62+
userid: id,
63+
},
64+
})
65+
.then(async function (response) {
66+
console.log(response.data);
67+
toast({
68+
title: "Success",
69+
description: response.data.message,
70+
});
71+
await fetchFiles();
72+
})
73+
.catch(async function (error) {
74+
console.error(error.response);
75+
toast({
76+
variant: "destructive",
77+
title: "Error",
78+
description: error.message,
79+
});
80+
});
81+
}
82+
};
83+
84+
return (
85+
<section className="flex flex-col gap-8 mt-8">
86+
<article>
87+
<h3 className="text-white md:text-2xl lg:text-2xl text-xl">
88+
Your files
89+
</h3>
90+
</article>
91+
{dataLoading ? (
92+
<Loader />
93+
) : (
94+
<Table>
95+
<TableCaption className="text-lightgrey/70">
96+
A list of your uploaded files.
97+
</TableCaption>
98+
<TableHeader>
99+
<TableRow className="border border-transparent border-b-borderbtm/80 bg-[#282c34]/50 hover:bg-[#282c34]/50">
100+
<TableHead className="text-white">Name</TableHead>
101+
<TableHead className="text-white">Type</TableHead>
102+
<TableHead className="text-white">Size</TableHead>
103+
<TableHead className="text-white">Created</TableHead>
104+
<TableHead className="text-white"></TableHead>
105+
</TableRow>
106+
</TableHeader>
107+
<TableBody>
108+
{files.map((item: typeFile, index: number) => {
109+
const editedFile = item.filename;
110+
return (
111+
<TableRow
112+
key={item.uploadID}
113+
className="cursor-pointer border border-transparent border-b-borderbtm/80 bg-[#282c34]/50 hover:bg-[#282c34]/30"
114+
>
115+
<TableCell
116+
className="text-midwhite2"
117+
onClick={() =>
118+
router.push(`/file/${item.filename}/${item.uploadID}`)
119+
}
120+
>
121+
{item.filename.substring(0, 10) + "..."}
122+
</TableCell>
123+
<TableCell
124+
className="text-midwhite2"
125+
onClick={() =>
126+
router.push(`/file/${item.filename}/${item.uploadID}`)
127+
}
128+
>
129+
{item.filetype}
130+
</TableCell>
131+
132+
<TableCell
133+
className="text-midwhite2"
134+
onClick={() =>
135+
router.push(`/file/${item.filename}/${item.uploadID}`)
136+
}
137+
>
138+
{item.filesize}
139+
</TableCell>
140+
<TableCell
141+
className="text-midwhite2"
142+
onClick={() =>
143+
router.push(`/file/${item.filename}/${item.uploadID}`)
144+
}
145+
>
146+
{item.date}
147+
</TableCell>
148+
<TableCell
149+
className="flex gap-3"
150+
onClick={(e) => e.preventDefault()}
151+
>
152+
<DropdownMenu>
153+
<DropdownMenuTrigger asChild>
154+
<MoreHorizontal className="cursor-pointer w-4 h-4 text-white" />
155+
</DropdownMenuTrigger>
156+
<DropdownMenuContent className="bg-[#111213] border border-darkbtn p-4 w-48 rounded-md">
157+
<nav className="flex flex-col gap-2">
158+
<DropdownMenuItem
159+
className="p-3 bg-transparent transition-colors hover:bg-hovergrey cursor-pointer select-none rounded-md text-midwhite border-none outline-none flex items-center justify-between gap-2"
160+
onClick={() => setShow(true)}
161+
>
162+
Share{" "}
163+
{/* <ArrowDownToLine className="w-4 h-4" /> */}
164+
<Forward className="w-4 h-4" />
165+
</DropdownMenuItem>
166+
<DropdownMenuItem
167+
className="p-3 bg-transparent transition-colors hover:bg-hovergrey cursor-pointer select-none rounded-md text-midwhite border-none outline-none flex items-center justify-between gap-2"
168+
onClick={() =>
169+
deleteFile(item.filename, item.uploadID)
170+
}
171+
>
172+
Delete <Trash2 className="w-4 h-4" />
173+
</DropdownMenuItem>
174+
</nav>
175+
</DropdownMenuContent>
176+
</DropdownMenu>
177+
</TableCell>
178+
</TableRow>
179+
);
180+
})}
181+
</TableBody>
182+
</Table>
183+
)}
184+
</section>
185+
);
186+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /