Skip to content
This repository was archived by the owner on Nov 5, 2023. It is now read-only.

Commit ec07661

Browse files
release: v0.9.0 (#29)
* feat: Access management dialog (#27) * feat: Add access management dialog to dialogs context * feat(ui): Add access management dialog to the ui * chore(deps): Add shadcn scroll area * feat: Access management dialog * refactor: Create callbacks to add and remove users from the ui * fix(a11y): Solve button-in-button error * feat: Download file (#28) * build: Update nginx config (#31) --------- Co-authored-by: Miguel Mateo Mendoza Rojas <115849391+MiguelMRojas@users.noreply.github.com>
1 parent 5e672a4 commit ec07661

29 files changed

+576
-56
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
e2e

CHANGELOG.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
# [0.7.0](https://github.com/PedroChaparro/unofficial-frontend-react/compare/v0.6.1...v0.7.0) (2023-10-20)
1+
# [0.9.0](https://github.com/PedroChaparro/alternative-frontend-react/compare/v0.8.0...v0.9.0) (2023-10-21)
22

33

44
### Features
55

6-
* Create folder ([#24](https://github.com/PedroChaparro/unofficial-frontend-react/issues/24)) ([54dc7c1](https://github.com/PedroChaparro/unofficial-frontend-react/commit/54dc7c15c36fa3b19bad68caed62a6c45e8ccb54))
6+
* Download file ([#28](https://github.com/PedroChaparro/alternative-frontend-react/issues/28)) ([b55be6c](https://github.com/PedroChaparro/alternative-frontend-react/commit/b55be6cec070a0e50d94c5062eab408d9d9c0e31))
77

88

99

10-
## [0.6.1](https://github.com/PedroChaparro/unofficial-frontend-react/compare/v0.6.0...v0.6.1) (2023-10-20)
10+
# [0.8.0](https://github.com/PedroChaparro/alternative-frontend-react/compare/v0.7.0...v0.8.0) (2023-10-21)
1111

1212

13-
### Bug Fixes
13+
### Features
1414

15-
* Go back button in folders navigation ([#23](https://github.com/PedroChaparro/unofficial-frontend-react/issues/23)) ([07edb44](https://github.com/PedroChaparro/unofficial-frontend-react/commit/07edb442b2524bd739bf7f0d6ea13f536b1a62b9))
15+
* Access management dialog ([#27](https://github.com/PedroChaparro/alternative-frontend-react/issues/27)) ([24e4048](https://github.com/PedroChaparro/alternative-frontend-react/commit/24e40482f1c44e21ab25a52a758b1acf8cf7ef37))
1616

1717

1818

19-
# [0.6.0](https://github.com/PedroChaparro/unofficial-frontend-react/compare/v0.5.0...v0.6.0) (2023-10-20)
19+
# [0.7.0](https://github.com/PedroChaparro/alternative-frontend-react/compare/v0.6.1...v0.7.0) (2023-10-20)
2020

2121

2222
### Features
2323

24-
* Move files ([#21](https://github.com/PedroChaparro/unofficial-frontend-react/issues/21)) ([3a470e9](https://github.com/PedroChaparro/unofficial-frontend-react/commit/3a470e97df16f038658bb2e13019c2adda4a5e0a))
24+
* Create folder ([#24](https://github.com/PedroChaparro/alternative-frontend-react/issues/24)) ([54dc7c1](https://github.com/PedroChaparro/alternative-frontend-react/commit/54dc7c15c36fa3b19bad68caed62a6c45e8ccb54))
2525

2626

2727

28-
# [0.5.0](https://github.com/PedroChaparro/unofficial-frontend-react/compare/v0.4.0...v0.5.0) (2023-10-20)
28+
## [0.6.1](https://github.com/PedroChaparro/alternative-frontend-react/compare/v0.6.0...v0.6.1) (2023-10-20)
2929

3030

31-
### Features
31+
### Bug Fixes
3232

33-
* Home page ([#20](https://github.com/PedroChaparro/unofficial-frontend-react/issues/20)) ([36a272a](https://github.com/PedroChaparro/unofficial-frontend-react/commit/36a272ad72732e2eb8b21c8a18a9dfab7d72c837))
33+
* Go back button in folders navigation ([#23](https://github.com/PedroChaparro/alternative-frontend-react/issues/23)) ([07edb44](https://github.com/PedroChaparro/alternative-frontend-react/commit/07edb442b2524bd739bf7f0d6ea13f536b1a62b9))
3434

3535

3636

37-
# [0.4.0](https://github.com/PedroChaparro/unofficial-frontend-react/compare/v0.3.0...v0.4.0) (2023-10-17)
37+
# [0.6.0](https://github.com/PedroChaparro/alternative-frontend-react/compare/v0.5.0...v0.6.0) (2023-10-20)
3838

3939

4040
### Features
4141

42-
* Rename files ([#18](https://github.com/PedroChaparro/unofficial-frontend-react/issues/18)) ([bbc6f61](https://github.com/PedroChaparro/unofficial-frontend-react/commit/bbc6f611b9f8dd9526d67e55bc79aabc1a9acdb2))
42+
* Move files ([#21](https://github.com/PedroChaparro/alternative-frontend-react/issues/21)) ([3a470e9](https://github.com/PedroChaparro/alternative-frontend-react/commit/3a470e97df16f038658bb2e13019c2adda4a5e0a))
4343

4444

4545

Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@
22
FROM node:20.5.1-alpine3.18 AS builder
33
WORKDIR /app
44

5+
RUN npm install -g npm@latest
56
RUN npm install -g pnpm
67

78
COPY package.json pnpm-lock.yaml ./
89
RUN pnpm install
910

11+
ENV VITE_PROXY_BASE_URL=http://capyfile1.bucaramanga.upb.edu.co/api/python
12+
1013
COPY . .
1114
RUN pnpm build
1215

1316
# --- Run stage ---
14-
FROM nginx:1-alpine3.18-slim AS runner
17+
FROM nginx:mainline-alpine3.18-slim AS runner
18+
RUN rm /etc/nginx/conf.d/default.conf
1519

16-
COPY ./config/nginx.conf /etc/nginx/conf.d/default.conf
17-
COPY --from=builder /app/dist /var/www/capyfile/html
20+
COPY nginx.conf /etc/nginx/conf.d
21+
COPY --from=builder /app/dist /usr/share/nginx/html
1822

1923
EXPOSE 80
20-
CMD ["nginx", "-g", "daemon off;"]
24+
ENTRYPOINT ["nginx", "-g", "daemon off;"]

config/nginx.conf

Lines changed: 0 additions & 11 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

e2e/files/data/out/.gitkeep

Whitespace-only changes.

e2e/files/download-file.spec.tsx

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { faker } from "@faker-js/faker";
2+
import { expect, test } from "@playwright/test";
3+
import path from "path";
4+
import { fileURLToPath } from "url";
5+
6+
const __filename = fileURLToPath(import.meta.url);
7+
const __dirname = path.dirname(__filename);
8+
9+
test.describe.serial("Users can download files", () => {
10+
const username = faker.internet.userName();
11+
const password = faker.internet.password({ length: 8 });
12+
13+
test("Register test user", async ({ page }) => {
14+
await page.goto("/register");
15+
16+
await page.getByLabel("Username").fill(username);
17+
await page.getByLabel("Password", { exact: true }).fill(password);
18+
await page.getByLabel("Confirm Password", { exact: true }).fill(password);
19+
await page.getByRole("button", { name: "Submit", exact: true }).click();
20+
21+
await expect(page.getByText("Account created successfully")).toBeVisible();
22+
await page.waitForURL(/\/files$/);
23+
});
24+
25+
test("Upload test file", async ({ page }) => {
26+
// Login with the registered user
27+
await page.goto("/login");
28+
await page.getByLabel("Username").fill(username);
29+
await page.getByLabel("Password", { exact: true }).fill(password);
30+
await page.getByRole("button", { name: "Submit", exact: true }).click();
31+
await page.waitForURL(/\/files$/);
32+
33+
// Open the upload modal
34+
await page.getByRole("button", { name: "Upload file" }).click();
35+
await expect(page.getByRole("dialog")).toBeVisible();
36+
37+
// Upload a file
38+
const filesInput = page.getByLabel("Choose files to upload", {
39+
exact: true
40+
});
41+
await filesInput.setInputFiles(path.join(__dirname, "data/in/yellow.jpg"));
42+
await page.getByRole("button", { name: "Upload", exact: true }).click();
43+
44+
// Assert file is shown
45+
await expect(page.getByText("yellow.jpg")).toBeVisible();
46+
});
47+
48+
test("Download file", async ({ page }) => {
49+
// Login with the registered user
50+
await page.goto("/login");
51+
await page.getByLabel("Username").fill(username);
52+
await page.getByLabel("Password", { exact: true }).fill(password);
53+
await page.getByRole("button", { name: "Submit", exact: true }).click();
54+
await page.waitForURL(/\/files$/);
55+
56+
// Assert file is shown
57+
const fileCard = page.getByRole("button", { name: "yellow.jpg card" });
58+
await expect(fileCard).toBeVisible();
59+
60+
// Download the file
61+
const downloadPromise = page.waitForEvent("download");
62+
await fileCard.click();
63+
64+
const download = await downloadPromise;
65+
await download.saveAs(path.join(__dirname, "data/out/yellow.jpg"));
66+
});
67+
});

e2e/files/move-file.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ test.describe.serial("Users can move a file", () => {
4040
const filesInput = page.getByLabel("Choose files to upload", {
4141
exact: true
4242
});
43-
await filesInput.setInputFiles(path.join(__dirname, "data/yellow.jpg"));
43+
await filesInput.setInputFiles(path.join(__dirname, "data/in/yellow.jpg"));
4444
await page.getByRole("button", { name: "Upload", exact: true }).click();
4545

4646
// Assert file is shown

e2e/files/rename-files.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ test.describe.serial("Users can rename files", () => {
3939
const filesInput = page.getByLabel("Choose files to upload", {
4040
exact: true
4141
});
42-
await filesInput.setInputFiles(path.join(__dirname, "data/yellow.jpg"));
42+
await filesInput.setInputFiles(path.join(__dirname, "data/in/yellow.jpg"));
4343
await page.getByRole("button", { name: "Upload", exact: true }).click();
4444

4545
// Assert file is shown

e2e/files/upload-files.spec.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ test.describe.serial("Users can upload files", () => {
4040
exact: true
4141
});
4242
await filesInput.setInputFiles([
43-
path.join(__dirname, "data/yellow.jpg"),
44-
path.join(__dirname, "data/blue.jpg"),
45-
path.join(__dirname, "data/red.jpg")
43+
path.join(__dirname, "data/in/yellow.jpg"),
44+
path.join(__dirname, "data/in/blue.jpg"),
45+
path.join(__dirname, "data/in/red.jpg")
4646
]);
4747

4848
// Submit the form
@@ -73,7 +73,9 @@ test.describe.serial("Users can upload files", () => {
7373
const filesInput = page.getByLabel("Choose files to upload", {
7474
exact: true
7575
});
76-
await filesInput.setInputFiles([path.join(__dirname, "data/yellow.jpg")]);
76+
await filesInput.setInputFiles([
77+
path.join(__dirname, "data/in/yellow.jpg")
78+
]);
7779

7880
// Submit the form
7981
await page.getByRole("button", { name: "Upload", exact: true }).click();

nginx.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
server {
2+
listen 80;
3+
listen [::]:80;
4+
5+
location / {
6+
root /usr/share/nginx/html;
7+
index index.html;
8+
try_files $uri $uri/ /index.html;
9+
}
10+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "unofficial-frontend-react",
33
"private": true,
4-
"version": "0.7.0",
4+
"version": "0.9.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -20,6 +20,7 @@
2020
"@radix-ui/react-dialog": "^1.0.5",
2121
"@radix-ui/react-dropdown-menu": "^2.0.6",
2222
"@radix-ui/react-label": "^2.0.2",
23+
"@radix-ui/react-scroll-area": "^1.0.5",
2324
"@radix-ui/react-slot": "^1.0.2",
2425
"@radix-ui/react-tabs": "^1.0.4",
2526
"axios": "1.5.1",

pnpm-lock.yaml

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

src/components/file-card/Dropdown.tsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { FilesDialogsContext } from "@/context/index";
44
import { File } from "@/types/entities";
55
import { Dialogs } from "@/types/enums";
6-
import { MoreVertical, PenBox, Truck } from "lucide-react";
6+
import { Download, Key, MoreVertical, PenBox, Truck } from "lucide-react";
77
import { useContext } from "react";
88

99
import { Button } from "../ui/button";
@@ -39,31 +39,30 @@ export const DropDown = ({ file }: { file: File }) => {
3939
Move {file.isFile ? "file" : "directory"}
4040
</DropdownMenuItem>
4141
{/*
42-
<DropdownMenuItem>
42+
<DropdownMenuItem>
43+
<Trash2 className="mr-2 h-4 w-4" />
44+
Remove {file.isFile ? "file" : "directory"}
45+
</DropdownMenuItem>
46+
*/}
47+
<DropdownMenuItem
48+
onClick={(e) => {
49+
e.stopPropagation();
50+
openDialog(Dialogs.ACCESS_MANAGEMENT, file);
51+
}}
52+
>
4353
<Key className="mr-2 h-4 w-4" />
4454
Manage access
4555
</DropdownMenuItem>
46-
<DropdownMenuItem onClick={() => openDialog(Dialogs.RENAME_FILE, file)}>
47-
<PenBox className="mr-2 h-4 w-4" />
48-
Rename {file.isFile ? "file" : "directory"}
49-
</DropdownMenuItem>
50-
<DropdownMenuItem>
51-
<Trash2 className="mr-2 h-4 w-4" />
52-
Remove {file.isFile ? "file" : "directory"}
53-
</DropdownMenuItem>
54-
*/}
5556
</>
5657
);
5758

5859
if (file.isFile) {
5960
return (
6061
<DropdownMenuContent className="w-48">
61-
{/*
6262
<DropdownMenuItem>
6363
<Download className="mr-2 h-4 w-4" />
6464
Download file
6565
</DropdownMenuItem>
66-
*/}
6766
{sharedActions}
6867
</DropdownMenuContent>
6968
);

0 commit comments

Comments
 (0)