UI update

This commit is contained in:
2026-06-20 17:02:05 +10:00
parent 87357d5297
commit 09ab959b08
3 changed files with 38 additions and 7 deletions
+17 -4
View File
@@ -1,3 +1,4 @@
import { CodeIcon, LinkIcon } from 'lucide-react';
import { useEffect, useMemo, useState, type KeyboardEvent as ReactKeyboardEvent, type SyntheticEvent } from 'react';
import type { Link } from '../lib/api';
import { safeLinkTargetUrl } from '../lib/url';
@@ -83,6 +84,18 @@ function handleRowKeyDown(event: ReactKeyboardEvent<HTMLElement>, link: Pick<Lin
}
}
function LinkTypeBadge({ linkType, className }: { linkType: Link['linkType']; className?: string }) {
const isCustom = linkType === 'custom';
const Icon = isCustom ? CodeIcon : LinkIcon;
return (
<span className={`link-type-badge ${isCustom ? 'is-custom' : 'is-redirect'}${className ? ` ${className}` : ''}`}>
<Icon aria-hidden="true" size={14} strokeWidth={2.2} />
<span>{isCustom ? 'Custom' : 'Redirect'}</span>
</span>
);
}
export default function LinkTable({
links,
loading = false,
@@ -260,11 +273,11 @@ export default function LinkTable({
style={{ textDecoration: 'none' }}
onClick={stopRowNavigation}
>
#{link.alias}
/{link.alias}
</a>
{link.description ? <small className="row-description">{link.description}</small> : null}
</td>
<td>{link.linkType === 'custom' ? 'Custom' : 'Redirect'}</td>
<td><LinkTypeBadge linkType={link.linkType} /></td>
<td className="col-target">
{link.linkType === 'redirect' ? (
link.targetUrl ? (
@@ -347,9 +360,9 @@ export default function LinkTable({
style={{ textDecoration: 'none', fontSize: '0.8125rem' }}
onClick={stopRowNavigation}
>
#{link.alias}
/{link.alias}
</a>
<span className="link-card-type-badge">{link.linkType === 'custom' ? 'Custom' : 'Redirect'}</span>
<LinkTypeBadge linkType={link.linkType} className="link-card-type-badge" />
</div>
{link.description ? <p className="link-card-desc">{link.description}</p> : null}
{link.linkType === 'redirect' && link.targetUrl ? (
-1
View File
@@ -31,7 +31,6 @@ export default function PublicLinksPage() {
<h1>Public Links</h1>
<p className="muted">Public shortlinks anyone can resolve.</p>
</div>
<button type="button" onClick={() => void refresh()} disabled={loading}>Refresh</button>
</header>
<LinkTable
+21 -2
View File
@@ -531,6 +531,27 @@ button.link-action--confirm:hover { background: var(--accent-soft); }
line-height: 1.45;
}
.link-type-badge {
align-items: center;
display: inline-flex;
gap: 0.4rem;
font-size: 0.75rem;
font-weight: 600;
line-height: 1;
}
.link-type-badge svg {
flex-shrink: 0;
}
.link-type-badge.is-redirect {
color: #2563EB;
}
.link-type-badge.is-custom {
color: #16A34A;
}
.truncate {
display: inline-block;
max-width: 22rem;
@@ -615,9 +636,7 @@ button.link-action--confirm:hover { background: var(--accent-soft); }
}
.link-card-type-badge {
color: var(--muted);
font-size: 0.7rem;
font-weight: 600;
letter-spacing: 0.04em;
margin-left: auto;
text-transform: uppercase;