feat(web): redesign frontend UI with modern card layout, drag-drop upload, toast notifications, and responsive design
This commit is contained in:
+100
-22
@@ -2,40 +2,118 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>yDropbox</title>
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<script defer src="/alpine.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div x-data="app()" x-init="loadFiles()">
|
||||
<div class="app" x-data="app()" x-init="loadFiles()">
|
||||
<header>
|
||||
<h1>yDropbox</h1>
|
||||
<button @click="logout()">Logout</button>
|
||||
<h1>y<span>Dropbox</span></h1>
|
||||
<button class="btn btn-logout" @click="logout()">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>
|
||||
Logout
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<section>
|
||||
<h2>Inbox</h2>
|
||||
<input type="file" @change="upload($event, 'inbox')">
|
||||
<template x-for="file in inboxFiles" :key="file.id">
|
||||
<div class="file-row">
|
||||
<span x-text="file.original_name"></span>
|
||||
<button @click="download(file.id)">Download</button>
|
||||
<button @click="deleteFile(file.id)">Delete</button>
|
||||
<button @click="share(file.id)">Share</button>
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h2>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/></svg>
|
||||
Inbox
|
||||
<span class="badge" x-text="inboxFiles.length"></span>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="section-body">
|
||||
<div class="drop-zone" :class="{ 'dragover': dragover }"
|
||||
@dragover.prevent="dragover = true"
|
||||
@dragleave.prevent="dragover = false"
|
||||
@drop.prevent="dragover = false; uploadDropped($event, 'inbox')">
|
||||
<input type="file" @change="upload($event, 'inbox')" multiple>
|
||||
<div class="drop-zone-icon">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
|
||||
</div>
|
||||
<div class="drop-zone-text"><strong>Click to upload</strong> or drag and drop</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template x-if="inboxFiles.length === 0">
|
||||
<div class="empty-state">
|
||||
<div class="empty-state-icon">
|
||||
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M22 12h-4l-3 3L9 9l-3 3H2"/></svg>
|
||||
</div>
|
||||
<div class="empty-state-text">No files in inbox</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<ul class="file-list">
|
||||
<template x-for="file in inboxFiles" :key="file.id">
|
||||
<li class="file-row">
|
||||
<div class="file-icon">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>
|
||||
</div>
|
||||
<div class="file-info">
|
||||
<div class="file-name" x-text="file.name"></div>
|
||||
</div>
|
||||
<div class="file-actions">
|
||||
<button class="btn btn-sm btn-ghost" @click="download(file.id)" title="Download">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-ghost" @click="share(file.id)" title="Share">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-ghost btn-danger" @click="deleteFile(file.id)" title="Delete">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Outbox</h2>
|
||||
<template x-for="file in outboxFiles" :key="file.id">
|
||||
<div class="file-row">
|
||||
<span x-text="file.original_name"></span>
|
||||
<button @click="download(file.id)">Download</button>
|
||||
<button @click="deleteFile(file.id)">Delete</button>
|
||||
</div>
|
||||
</template>
|
||||
<section class="section">
|
||||
<div class="section-header">
|
||||
<h2>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
|
||||
Outbox
|
||||
<span class="badge" x-text="outboxFiles.length"></span>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="section-body">
|
||||
<template x-if="outboxFiles.length === 0">
|
||||
<div class="empty-state">
|
||||
<div class="empty-state-icon">
|
||||
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>
|
||||
</div>
|
||||
<div class="empty-state-text">No files in outbox</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<ul class="file-list">
|
||||
<template x-for="file in outboxFiles" :key="file.id">
|
||||
<li class="file-row">
|
||||
<div class="file-icon">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>
|
||||
</div>
|
||||
<div class="file-info">
|
||||
<div class="file-name" x-text="file.name"></div>
|
||||
</div>
|
||||
<div class="file-actions">
|
||||
<button class="btn btn-sm btn-ghost" @click="download(file.id)" title="Download">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-ghost btn-danger" @click="deleteFile(file.id)" title="Delete">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="toast" :class="{ 'show': toast.show }" x-text="toast.message"></div>
|
||||
</div>
|
||||
<script src="/app.js"></script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user