Files
frislit/client/src/pages/Select/Select.jsx
T
fristy 650807c1fb
CI / Docker image (push) Successful in 12s
CI / Server (push) Successful in 25s
CI / CLI (push) Successful in 13s
Development image / Development image (push) Successful in 21s
CI / CLI (windows) (push) Successful in 57s
CI / CLI (linux-arm64, static) (push) Successful in 1m37s
Release / Prepare release (push) Successful in 2s
Release / Server (linux-x64) (push) Successful in 53s
Release / CLI (linux-arm64, static) (push) Successful in 1m32s
Release / Docker image (push) Successful in 2m48s
Release / Server (windows-x64) (push) Successful in 6m20s
Release / CLI (windows-x64) (push) Successful in 6m48s
Release / CLI (linux-x64) (push) Successful in 7m8s
Release / Publish release (push) Successful in 1s
chore: restart the repository with a clean history
Squash the tree into one commit, drop docs/architecture.html, reset the version line to 0.3.0, consolidate the changelog, enable Renovate automerge for non-major updates and add AGENTS.md.
2026-11-10 11:31:13 +03:00

40 lines
1.5 KiB
React

import "./styles.sass";
import { useState } from "react";
import { useNavigate } from "react-router-dom";
import Input from "@/common/components/Input";
import Button from "@/common/components/Button";
import { useUser } from "@/common/contexts/user.js";
import { resetWorkers } from "@/common/utils/tunnelTab.js";
export const Select = () => {
const { user } = useUser();
const navigate = useNavigate();
const [id, setId] = useState("");
const open = async event => {
event.preventDefault();
const name = id.trim().toLowerCase().replace(/^@/, "");
if (!name) return;
await resetWorkers();
window.location.href = `/@${encodeURIComponent(name)}`;
};
return (
<form className="select-page" onSubmit={open}>
<div className="form-head">
<h1>No tunnel selected.</h1>
<p>Enter a tunnel id to open it in this browser.</p>
</div>
<div className="form-body">
<Input id="tunnel-id" label="Tunnel id" placeholder="k3x9ab" value={id} setValue={setId} autoFocus />
</div>
<div className="form-actions">
<Button type="ghost" text={user ? "Dashboard" : "Admin login"} buttonType="button"
onClick={() => navigate(user ? "/tunnels" : "/login")} />
<div className="spacer" />
<Button text="Open" buttonType="submit" disabled={!id.trim()} />
</div>
</form>
);
};