diff --git a/pkgs/ui/src/app/layout.tsx b/pkgs/ui/src/app/layout.tsx
index f541db665..5bd3b55c2 100644
--- a/pkgs/ui/src/app/layout.tsx
+++ b/pkgs/ui/src/app/layout.tsx
@@ -1,24 +1,17 @@
"use client";
import { Sidebar } from "@/components/sidebar";
import { tw } from "@/utils/tailwind";
-import MenuIcon from "@mui/icons-material/Menu";
-import {
- CssBaseline,
- IconButton,
- ThemeProvider,
- useMediaQuery,
-} from "@mui/material";
+import { CssBaseline, ThemeProvider, useMediaQuery } from "@mui/material";
import { StyledEngineProvider } from "@mui/material/styles";
import axios from "axios";
import localFont from "next/font/local";
-import Image from "next/image";
import * as React from "react";
import { Toaster } from "react-hot-toast";
import "./globals.css";
import { darkTheme, lightTheme } from "./theme/themes";
-import { WithAppState } from "@/components/hooks/useAppContext";
import { ClanToolbar } from "@/components/clanToolbar";
+import { WithAppState } from "@/components/hooks/useAppContext";
const roboto = localFont({
src: [
@@ -70,29 +63,10 @@ export default function RootLayout({
!showSidebar && translate
} flex h-full w-full flex-col overflow-y-scroll transition-[margin] duration-150 ease-in-out`}
>
-
-
-
-
- setShowSidebar((c) => !c)}
- >
- {!showSidebar && }
-
-
-
-
-
-
-
-
+
{children}
diff --git a/pkgs/ui/src/components/clanToolbar/index.tsx b/pkgs/ui/src/components/clanToolbar/index.tsx
index 53ea56144..c851df9ae 100644
--- a/pkgs/ui/src/components/clanToolbar/index.tsx
+++ b/pkgs/ui/src/components/clanToolbar/index.tsx
@@ -1,6 +1,7 @@
import { useFlakeHistoryList } from "@/api/flake/flake";
import DynamicFeedIcon from "@mui/icons-material/DynamicFeed";
-import { IconButton, LinearProgress } from "@mui/material";
+import MenuIcon from "@mui/icons-material/Menu";
+import { Button, Divider, LinearProgress } from "@mui/material";
import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
import * as React from "react";
@@ -9,57 +10,112 @@ interface ToolbarButtonProps {
icon: React.ReactNode;
onClick: (event: React.MouseEvent
) => void;
}
-function ToolbarButton(props: ToolbarButtonProps) {
+export function ToolbarButton(props: ToolbarButtonProps) {
const { icon, onClick } = props;
return (
-
- {icon}
-
+
);
}
+
+const ClanHistoryMenu = () => {
+ const { data, isLoading } = useFlakeHistoryList();
+
+ return (
+ <>
+ {isLoading ? (
+
+ ) : (
+ data?.data.map((item, index) => )
+ )}
+ {!isLoading && data?.data.length === 0 && (
+
+ )}
+ >
+ );
+};
+
type ToolbarItem = {
icon: React.ReactNode;
+ menu: React.ReactNode;
};
const toolbarItems: ToolbarItem[] = [
{
icon: ,
+ menu: ,
},
];
-export function ClanToolbar() {
- const { data, isLoading } = useFlakeHistoryList();
+
+interface ClanToolbarProps {
+ isSidebarVisible: boolean;
+ handleSidebar: React.Dispatch>;
+}
+export function ClanToolbar(props: ClanToolbarProps) {
+ const { isSidebarVisible, handleSidebar } = props;
+
const [anchorEl, setAnchorEl] = React.useState(null);
- const open = Boolean(anchorEl);
- const handleClick = (event: React.MouseEvent) => {
+ const [openIdx, setOpenIdx] = React.useState(null);
+
+ const handleClick = (
+ event: React.MouseEvent,
+ idx: number
+ ) => {
setAnchorEl(event.currentTarget);
+ setOpenIdx(idx);
};
const handleClose = () => {
setAnchorEl(null);
+ setOpenIdx(null);
};
return (
-
- {toolbarItems.map((item, index) => (
-
- ))}
-
);
}
diff --git a/pkgs/ui/src/error/errorToast.ts b/pkgs/ui/src/error/errorToast.ts
index c6f2ad3ed..4dec64432 100644
--- a/pkgs/ui/src/error/errorToast.ts
+++ b/pkgs/ui/src/error/errorToast.ts
@@ -5,8 +5,10 @@ import { toast } from "react-hot-toast";
export function clanErrorToast(error: AxiosError) {
console.error({ error });
const detail = error.response?.data.detail?.[0]?.msg;
+ const detailAlt = error.response?.data.detail as unknown as string;
const cause = error.cause?.message;
const axiosMessage = error.message;
- const sanitizedMsg = detail || cause || axiosMessage || "Unexpected error";
+ const sanitizedMsg =
+ detail || detailAlt || cause || axiosMessage || "Unexpected error";
toast.error(sanitizedMsg);
}