-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ContentsViewer/feature/fix-gradient
Feature/fix gradient
- Loading branch information
Showing
5 changed files
with
360 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,95 @@ | ||
'use client' | ||
"use client" | ||
|
||
import { FileList } from '@/src/components/file-list'; | ||
import { useFileStore } from '@/src/stores/file-store'; | ||
import { FileList } from "@/src/components/file-list" | ||
import { useFileStore } from "@/src/stores/file-store" | ||
import { Cloud, Login } from "@mui/icons-material" | ||
import { | ||
Avatar, | ||
Box, | ||
Button, | ||
List, | ||
ListItem, | ||
ListItemAvatar, | ||
ListItemButton, | ||
ListItemIcon, | ||
Paper, | ||
Typography, | ||
} from "@mui/material" | ||
import { useEffect } from "react" | ||
|
||
const LoginPage = () => { | ||
const [fileStoreState] = useFileStore() | ||
|
||
export default function Page() { | ||
const [fileStoreState] = useFileStore(); | ||
const pca = fileStoreState.pca | ||
if (!pca) return null | ||
|
||
const accounts = pca.getAllAccounts() | ||
|
||
return ( | ||
<Box> | ||
<Paper | ||
sx={{ | ||
maxWidth: 400, | ||
width: "80%", | ||
padding: 2, | ||
margin: "auto", | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
flexDirection: "column", | ||
}} | ||
> | ||
<Cloud sx={{ fontSize: 100 }} /> | ||
<Typography variant="h5">Sign in to OneDrive</Typography> | ||
<List> | ||
{accounts.map(account => ( | ||
<ListItemButton key={account.username} onClick={() => {}}> | ||
<ListItemAvatar> | ||
<Avatar /> | ||
</ListItemAvatar> | ||
<Typography variant="body1" sx={{ flexGrow: 1 }}> | ||
{account.username} | ||
</Typography> | ||
<Login sx={{ ml: 1 }} /> | ||
</ListItemButton> | ||
))} | ||
<ListItemButton | ||
onClick={() => { | ||
pca.setActiveAccount(null) | ||
const loginRequest = { | ||
scopes: ["Files.Read", "Sites.Read.All"], | ||
} | ||
pca.loginRedirect(loginRequest) | ||
}} | ||
> | ||
<ListItemAvatar> | ||
<Avatar /> | ||
</ListItemAvatar> | ||
<Typography variant="body1" sx={{ flexGrow: 1 }}> | ||
Add account | ||
</Typography> | ||
<Login sx={{ ml: 1 }} /> | ||
</ListItemButton> | ||
</List> | ||
</Paper> | ||
</Box> | ||
) | ||
} | ||
|
||
export default function Page() { | ||
const [fileStoreState] = useFileStore() | ||
|
||
useEffect(() => { | ||
if (fileStoreState.driveConfigureStatus !== "no-account") return | ||
console.log("no account") | ||
}, [fileStoreState]) | ||
|
||
const driveConfigureStatus = fileStoreState.driveConfigureStatus | ||
|
||
return driveConfigureStatus === "not-configured" ? null : driveConfigureStatus === | ||
"no-account" ? ( | ||
<LoginPage /> | ||
) : ( | ||
<FileList files={fileStoreState.rootFiles} /> | ||
); | ||
) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.