feat(frontend): remove "Upload" and "Last Stats" page
These are redundant and clunky, everything can be accessed from the Dataset tab
This commit is contained in:
@@ -34,9 +34,6 @@ const AppLayout = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [isSignedIn, setIsSignedIn] = useState(false);
|
const [isSignedIn, setIsSignedIn] = useState(false);
|
||||||
const [currentUser, setCurrentUser] = useState<Record<string, unknown> | null>(null);
|
const [currentUser, setCurrentUser] = useState<Record<string, unknown> | null>(null);
|
||||||
const [lastDatasetId, setLastDatasetId] = useState<string | null>(
|
|
||||||
localStorage.getItem("last_dataset_id")
|
|
||||||
);
|
|
||||||
|
|
||||||
const syncAuthState = useCallback(async () => {
|
const syncAuthState = useCallback(async () => {
|
||||||
const token = localStorage.getItem("access_token");
|
const token = localStorage.getItem("access_token");
|
||||||
@@ -66,17 +63,6 @@ const AppLayout = () => {
|
|||||||
void syncAuthState();
|
void syncAuthState();
|
||||||
}, [location.pathname, syncAuthState]);
|
}, [location.pathname, syncAuthState]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const datasetMatch = location.pathname.match(/^\/dataset\/(\d+)\/(status|stats)$/);
|
|
||||||
if (!datasetMatch) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const datasetId = datasetMatch[1];
|
|
||||||
localStorage.setItem("last_dataset_id", datasetId);
|
|
||||||
setLastDatasetId(datasetId);
|
|
||||||
}, [location.pathname]);
|
|
||||||
|
|
||||||
const onAuthButtonClick = () => {
|
const onAuthButtonClick = () => {
|
||||||
if (isSignedIn) {
|
if (isSignedIn) {
|
||||||
localStorage.removeItem("access_token");
|
localStorage.removeItem("access_token");
|
||||||
@@ -109,14 +95,6 @@ const AppLayout = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={styles.controlsWrapped}>
|
<div style={styles.controlsWrapped}>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
style={location.pathname === "/upload" ? styles.buttonPrimary : styles.buttonSecondary}
|
|
||||||
onClick={() => navigate("/upload")}
|
|
||||||
>
|
|
||||||
Upload
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
style={location.pathname === "/datasets" ? styles.buttonPrimary : styles.buttonSecondary}
|
style={location.pathname === "/datasets" ? styles.buttonPrimary : styles.buttonSecondary}
|
||||||
@@ -125,15 +103,6 @@ const AppLayout = () => {
|
|||||||
My datasets
|
My datasets
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
style={location.pathname.endsWith("/stats") ? styles.buttonPrimary : styles.buttonSecondary}
|
|
||||||
onClick={() => lastDatasetId && navigate(`/dataset/${lastDatasetId}/stats`)}
|
|
||||||
disabled={!lastDatasetId}
|
|
||||||
>
|
|
||||||
{lastDatasetId ? "Last stats" : "Last stats (none)"}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
style={isSignedIn ? styles.buttonSecondary : styles.buttonPrimary}
|
style={isSignedIn ? styles.buttonSecondary : styles.buttonPrimary}
|
||||||
|
|||||||
Reference in New Issue
Block a user