Sharing fixes, live preview
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m19s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m19s
This commit is contained in:
parent
27fd6fa4f5
commit
a52f1d63f7
4 changed files with 350 additions and 92 deletions
|
|
@ -9,6 +9,7 @@ export default function SharedFilesPage() {
|
|||
const [shares, setShares] = useState<any[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [copiedId, setCopiedId] = useState<string | null>(null);
|
||||
const [shareToRevoke, setShareToRevoke] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
loadShares();
|
||||
|
|
@ -26,11 +27,16 @@ export default function SharedFilesPage() {
|
|||
}
|
||||
}
|
||||
|
||||
async function handleRevoke(id: string) {
|
||||
if (!confirm('Are you sure you want to revoke this share link?')) return;
|
||||
function handleRevoke(id: string) {
|
||||
setShareToRevoke(id);
|
||||
}
|
||||
|
||||
async function confirmRevoke() {
|
||||
if (!shareToRevoke) return;
|
||||
try {
|
||||
await api.revokeShare(id);
|
||||
setShares(prev => prev.filter(s => s.id !== id));
|
||||
await api.revokeShare(shareToRevoke);
|
||||
setShares(prev => prev.filter(s => s.id !== shareToRevoke));
|
||||
setShareToRevoke(null);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
|
@ -120,6 +126,36 @@ export default function SharedFilesPage() {
|
|||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{shareToRevoke && (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center p-4" style={{ backgroundColor: 'rgba(0,0,0,0.5)', backdropFilter: 'blur(4px)' }}>
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.95 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
className="w-full max-w-md p-6 rounded-2xl shadow-xl"
|
||||
style={{ backgroundColor: 'var(--color-bg-elevated)', border: '1px solid var(--color-border)' }}
|
||||
>
|
||||
<h3 className="text-lg font-semibold mb-2" style={{ color: 'var(--color-text-primary)' }}>Revoke Share Link</h3>
|
||||
<p className="text-sm mb-6" style={{ color: 'var(--color-text-secondary)' }}>Are you sure you want to revoke this share link? Anyone with the link will lose access immediately.</p>
|
||||
<div className="flex justify-end gap-3">
|
||||
<button
|
||||
onClick={() => setShareToRevoke(null)}
|
||||
className="px-4 py-2 rounded-xl text-sm font-medium transition-colors"
|
||||
style={{ backgroundColor: 'var(--color-bg-secondary)', color: 'var(--color-text-primary)' }}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
onClick={confirmRevoke}
|
||||
className="px-4 py-2 rounded-xl text-sm font-medium transition-colors hover:bg-red-500/20"
|
||||
style={{ backgroundColor: 'rgba(239, 68, 68, 0.1)', color: '#ef4444' }}
|
||||
>
|
||||
Revoke Link
|
||||
</button>
|
||||
</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue