(props: { error: unknown; sessionID?: string; serverKey?: ServerConnection.Key })
| 177 | } |
| 178 | |
| 179 | function SessionErrorFallback(props: { error: unknown; sessionID?: string; serverKey?: ServerConnection.Key }) { |
| 180 | const language = useLanguage() |
| 181 | const server = useServer() |
| 182 | const tabs = useTabs() |
| 183 | const displayServer = createMemo(() => { |
| 184 | const key = props.serverKey ?? server.key |
| 185 | const conn = server.list.find((item) => ServerConnection.key(item) === key) |
| 186 | return conn ? serverName(conn) : key |
| 187 | }) |
| 188 | const closeTab = () => { |
| 189 | if (!props.sessionID) return |
| 190 | tabs.removeSessionTab({ server: props.serverKey ?? server.key, sessionId: props.sessionID }) |
| 191 | } |
| 192 | if (isCurrentSessionNotFoundError(props.error, props.sessionID)) { |
| 193 | return ( |
| 194 | <div class="flex-1 min-h-0 overflow-hidden"> |
| 195 | <div class="h-full px-6 pb-42 -mt-4 flex flex-col items-center justify-center text-center gap-4"> |
| 196 | <div class="flex flex-col items-center gap-2"> |
| 197 | <div class="text-16-medium text-text max-w-md">{language.t("session.error.notFound")}</div> |
| 198 | <div class="text-13-regular text-text-weak max-w-md"> |
| 199 | {language.t("session.error.notFound.description")} |
| 200 | </div> |
| 201 | </div> |
| 202 | <Show when={props.sessionID}> |
| 203 | {(sessionID) => ( |
| 204 | <div class="max-w-full flex flex-col items-center gap-1"> |
| 205 | <div class="max-w-full text-11-regular text-text-faint break-all">{displayServer()}</div> |
| 206 | <code class="max-w-full rounded-[4px] px-1 py-0.5 font-mono text-xs font-medium leading-4 text-text-base break-all bg-[color-mix(in_oklch,var(--v2-text-text-base)_8%,transparent)]"> |
| 207 | {sessionID()} |
| 208 | </code> |
| 209 | </div> |
| 210 | )} |
| 211 | </Show> |
| 212 | <ButtonV2 variant="neutral" size="normal" icon="xmark-small" onClick={closeTab}> |
| 213 | {language.t("session.error.notFound.closeTab")} |
| 214 | </ButtonV2> |
| 215 | </div> |
| 216 | </div> |
| 217 | ) |
| 218 | } |
| 219 | return <ErrorPage error={props.error} /> |
| 220 | } |
| 221 | |
| 222 | function ResolvedTargetSessionRoute() { |
| 223 | const params = useParams<{ serverKey: string; id: string }>() |
nothing calls this directly
no test coverage detected