Skip to content

Commit d6e9146

Browse files
committed
feat: add starred page and controller for displaying starred items
1 parent fff8b4d commit d6e9146

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

src/client/controller/starred.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { NextFunction, Request, Response } from "express";
2+
import { Controller } from "./controller.js";
3+
4+
export class StarredController extends Controller {
5+
6+
public static get(request: Request, response: Response, next: NextFunction) {
7+
const currentPath = request.path;
8+
9+
const pageData = {
10+
...Controller.defaultConfig,
11+
page: 'starred',
12+
title: 'Starred - CloudBox',
13+
currentPath
14+
};
15+
16+
response.render('layouts/main', pageData);
17+
}
18+
19+
}

src/client/routes/web.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import path from 'path';
33
import { fileURLToPath } from 'url';
44
import { DashboardController } from '../controller/dashboard.js';
55
import { MyFileController } from '../controller/my-file.js';
6+
import { StarredController } from '../controller/starred.js';
67

78
const __filename = fileURLToPath(import.meta.url);
89
const __dirname = path.dirname(__filename);
@@ -21,6 +22,7 @@ app.set('views', path.join(__dirname, './../views'));
2122

2223
app.get('/', DashboardController.get);
2324
app.get('/files', MyFileController.get);
25+
app.get('/starred', StarredController.get);
2426

2527

2628
export default app;

src/client/views/pages/starred.ejs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<main class="flex-1 overflow-y-auto bg-background relative">
2+
<%- include('../components/header') %>
3+
4+
<div class="p-8">
5+
<div class="flex items-center justify-between mb-8">
6+
<div>
7+
<h1 class="text-2xl font-bold text-slate-900">Starred</h1>
8+
<p class="text-sm text-slate-400">Files and folders you've starred for quick access</p>
9+
</div>
10+
</div>
11+
12+
<div class="border border-slate-100 rounded-lg p-12 text-center text-slate-400">
13+
<svg class="w-12 h-12 mx-auto text-slate-300" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.286 3.962a1 1 0 00.95.69h4.173c.969 0 1.371 1.24.588 1.81l-3.378 2.455a1 1 0 00-.364 1.118l1.287 3.962c.3.922-.755 1.688-1.54 1.118l-3.378-2.455a1 1 0 00-1.175 0L7.31 20.94c-.785.57-1.84-.196-1.54-1.118l1.287-3.962a1 1 0 00-.364-1.118L3.314 12.29c-.783-.57-.38-1.81.588-1.81h4.173a1 1 0 00.95-.69l1.286-3.962z"></path></svg>
14+
<h3 class="mt-6 font-semibold text-slate-800">No starred items</h3>
15+
<p class="text-sm mt-2">Star files or folders to quickly find them here.</p>
16+
</div>
17+
</div>
18+
</main>

0 commit comments

Comments
 (0)