atproto explorer

cleanup code

+20 -21
+14 -14
src/components/navbar.tsx
··· 12 12 export const [validSchema, setValidSchema] = createSignal<boolean | undefined>(undefined); 13 13 14 14 const swapIcons: Record<string, string> = { 15 - "did:plc:vwzwgnygau7ed7b7wt5ux7y2": "iconify lucide--microchip", 16 - "did:plc:oisofpd7lj26yvgiivf3lxsi": "iconify lucide--bone", 17 - "did:plc:uu5axsmbm2or2dngy4gwchec": "iconify lucide--train-track", 18 - "did:plc:7x6rtuenkuvxq3zsvffp2ide": "iconify lucide--rabbit", 19 - "did:plc:ia76kvnndjutgedggx2ibrem": "iconify lucide--rabbit", 20 - "did:plc:hvakvedv6byxhufjl23mfmsd": "iconify lucide--rat", 21 - "did:plc:ezhjhbzqt32bqprrn6qjlkri": "iconify lucide--film", 22 - "did:plc:6v6jqsy7swpzuu53rmzaybjy": "iconify lucide--fish", 23 - "did:plc:hx53snho72xoj7zqt5uice4u": "iconify lucide--rose", 24 - "did:plc:wzsilnxf24ehtmmc3gssy5bu": "iconify lucide--music-2", 25 - "did:plc:bnqkww7bjxaacajzvu5gswdf": "iconify lucide--gem", 26 - "did:plc:hdhoaan3xa3jiuq4fg4mefid": "iconify lucide--sparkles", 15 + "did:plc:vwzwgnygau7ed7b7wt5ux7y2": "lucide--microchip", 16 + "did:plc:oisofpd7lj26yvgiivf3lxsi": "lucide--bone", 17 + "did:plc:uu5axsmbm2or2dngy4gwchec": "lucide--train-track", 18 + "did:plc:7x6rtuenkuvxq3zsvffp2ide": "lucide--rabbit", 19 + "did:plc:ia76kvnndjutgedggx2ibrem": "lucide--rabbit", 20 + "did:plc:hvakvedv6byxhufjl23mfmsd": "lucide--rat", 21 + "did:plc:ezhjhbzqt32bqprrn6qjlkri": "lucide--film", 22 + "did:plc:6v6jqsy7swpzuu53rmzaybjy": "lucide--fish", 23 + "did:plc:hx53snho72xoj7zqt5uice4u": "lucide--rose", 24 + "did:plc:wzsilnxf24ehtmmc3gssy5bu": "lucide--music-2", 25 + "did:plc:bnqkww7bjxaacajzvu5gswdf": "lucide--gem", 26 + "did:plc:hdhoaan3xa3jiuq4fg4mefid": "lucide--sparkles", 27 27 }; 28 28 29 29 const NavBar = (props: { params: Params }) => { ··· 144 144 setShowHandle(!showHandle()); 145 145 }} 146 146 class={ 147 - `shrink-0 text-lg transition-transform duration-400 ${showHandle() ? "rotate-y-180" : ""} ` + 148 - (swapIcons[props.params.repo] ?? "iconify lucide--arrow-left-right") 147 + `iconify shrink-0 text-lg transition-transform duration-400 ${showHandle() ? "rotate-y-180" : ""} ` + 148 + (swapIcons[props.params.repo] ?? "lucide--arrow-left-right") 149 149 } 150 150 ></button> 151 151 </Tooltip>
+6 -7
src/layout.tsx
··· 1 1 import { createEffect, createSignal, ErrorBoundary, Show, Suspense } from "solid-js"; 2 - import { A, RouteSectionProps, useLocation, useNavigate, useParams } from "@solidjs/router"; 2 + import { A, RouteSectionProps, useLocation, useNavigate } from "@solidjs/router"; 3 3 import { agent } from "./components/login.jsx"; 4 4 import { RecordEditor } from "./components/create.jsx"; 5 5 import Tooltip from "./components/tooltip.jsx"; ··· 18 18 }>({ show: false }); 19 19 20 20 const Layout = (props: RouteSectionProps<unknown>) => { 21 - const params = useParams(); 22 21 const location = useLocation(); 23 22 const navigate = useNavigate(); 24 23 let timeout: number; 25 24 26 25 createEffect(async () => { 27 - if (params.repo && !params.repo.startsWith("did:")) { 28 - const did = await resolveHandle(params.repo as Handle); 29 - navigate(location.pathname.replace(params.repo, did)); 26 + if (props.params.repo && !props.params.repo.startsWith("did:")) { 27 + const did = await resolveHandle(props.params.repo as Handle); 28 + navigate(location.pathname.replace(props.params.repo, did)); 30 29 } 31 30 }); 32 31 ··· 72 71 <Show when={location.pathname !== "/jetstream" && location.pathname !== "/firehose"}> 73 72 <Search /> 74 73 </Show> 75 - <Show when={params.pds}> 76 - <NavBar params={params} /> 74 + <Show when={props.params.pds}> 75 + <NavBar params={props.params} /> 77 76 </Show> 78 77 <Show keyed when={location.pathname}> 79 78 <ErrorBoundary