mirror of
https://github.com/Vomitblood/stort.git
synced 2024-11-26 05:45:26 +08:00
config dir async import
This commit is contained in:
parent
50e8016b14
commit
8a8b5fcbc2
|
@ -1,6 +1,7 @@
|
|||
import { Close, UnfoldLess, UnfoldMore } from "@mui/icons-material";
|
||||
import { Box, IconButton, Modal, Tooltip, Typography } from "@mui/material";
|
||||
import { FC, ReactNode } from "react";
|
||||
import { useSettings } from "../../contexts/SettingsContext";
|
||||
|
||||
interface FloatingDialog {
|
||||
sx?: any;
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import { Box, Button, IconButton, Typography } from "@mui/material";
|
||||
import { WindowButtons } from "./WindowButtons";
|
||||
import { BugReport } from "@mui/icons-material";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
export const HeaderBar = () => {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<Box
|
||||
className="titlebar"
|
||||
|
@ -38,7 +41,11 @@ export const HeaderBar = () => {
|
|||
flexDirection: "row",
|
||||
}}
|
||||
>
|
||||
<IconButton href="/testing">
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
router.push("/testing");
|
||||
}}
|
||||
>
|
||||
<BugReport />
|
||||
</IconButton>
|
||||
<WindowButtons />
|
||||
|
|
|
@ -1,24 +1,41 @@
|
|||
"use client";
|
||||
|
||||
import { BugReport } from "@mui/icons-material";
|
||||
import { Box, Button, IconButton } from "@mui/material";
|
||||
import { configDir } from "@tauri-apps/api/path";
|
||||
import { Box, Button, IconButton, Typography } from "@mui/material";
|
||||
import { useRouter } from "next/router";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function Testing() {
|
||||
const testing = async () => {
|
||||
console.log(await configDir());
|
||||
const router = useRouter();
|
||||
|
||||
const [configDir, setConfigDir] = useState<string>("");
|
||||
|
||||
const initializeConfigDir = async () => {
|
||||
const { appConfigDir } = await import("@tauri-apps/api/path");
|
||||
setConfigDir(await appConfigDir());
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
initializeConfigDir();
|
||||
});
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<IconButton href="/">
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
router.push("/");
|
||||
}}
|
||||
>
|
||||
<BugReport />
|
||||
</IconButton>
|
||||
<Button
|
||||
onClick={() => {
|
||||
testing();
|
||||
console.log(configDir);
|
||||
}}
|
||||
>
|
||||
Button
|
||||
</Button>
|
||||
<Typography>{configDir}</Typography>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue