From ea12e01eedb7f0dceaaf1b21787fb244468de786 Mon Sep 17 00:00:00 2001 From: KoCoder Date: Thu, 4 Jun 2026 17:31:50 +0200 Subject: [PATCH] New: Table with List of redirections --- src/components/shortener/listRedirections.tsx | 47 +++++++++++++++++-- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/src/components/shortener/listRedirections.tsx b/src/components/shortener/listRedirections.tsx index 3a3e1d4..3bec49d 100644 --- a/src/components/shortener/listRedirections.tsx +++ b/src/components/shortener/listRedirections.tsx @@ -1,12 +1,14 @@ import { For, Match, Switch } from "solid-js"; import { listURLRedirections } from "~/gen/proto/shorten/v1/shorten-ShortenService_connectquery"; +import type { URLRedirection } from "~/gen/proto/shorten/v1/shorten_pb"; import { useConnectQuery } from "~/integrations/connect-query/solid"; const ListRedirections = () => { const query = useConnectQuery(listURLRedirections); return ( -
+
+

List of Redirections

Loading...
}>
Error: {query.error?.message}
@@ -15,13 +17,50 @@ const ListRedirections = () => {
Loading...
- - {(item) =>
{item.url}
} -
+ + + + + + + + + + + + + {(item) => } + + +
Short CodeURLActiveCreated AtExpires At
); }; +const Redirection = (props: { item: URLRedirection }) => { + return ( + + {props.item.shortCode} + {props.item.url} + {props.item.isActive ? "Yes" : "No"} + + {props.item.createdAt + ? new Date( + Number(props.item.createdAt.seconds) * 1000, + ).toLocaleDateString() + : ""} + + + {props.item.createdAt + ? new Date( + Number(props.item.expiresAt.seconds) * 1000, + ).toLocaleDateString() + : ""} + + + ); +}; + export default ListRedirections;