added bucket select

This commit is contained in:
Djeeberjr 2021-09-29 21:01:15 +02:00
parent f872bec629
commit 83c28a8d5e
3 changed files with 33 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import NotFound from "./components/NotFound"
import Login from "./components/Login" import Login from "./components/Login"
import { useIsAuthQuery } from "./generated/graphql" import { useIsAuthQuery } from "./generated/graphql"
import { useEffect } from "react" import { useEffect } from "react"
import BucketSelect from "./components/BucketSelect"
const App: React.FC = () => { const App: React.FC = () => {
const { data } = useIsAuthQuery() const { data } = useIsAuthQuery()
@ -27,6 +28,7 @@ const App: React.FC = () => {
{/* Private only routes */} {/* Private only routes */}
{ {
isAuth && [ isAuth && [
<Route path="/f/" exact component={BucketSelect} key={null} />,
<Route path="/f/" component={FileBrowser} key={null} />, <Route path="/f/" component={FileBrowser} key={null} />,
<Redirect from="/" exact to="/f/" key={null} />, <Redirect from="/" exact to="/f/" key={null} />,
<Redirect from="/login" exact to="/f/" key={null} />, <Redirect from="/login" exact to="/f/" key={null} />,

View File

@ -0,0 +1,30 @@
import React from "react"
import { useState } from "react"
import { Link } from "react-router-dom"
import Breadcrum from "./Breadcrum"
import MoreMenu from "./MoreMenu"
const BucketSelect: React.FC = () => {
const [buckets] = useState(["dev"])
return (
<div>
<div className="flex justify-between h-12">
<Breadcrum />
<div className="ml-auto">
<MoreMenu />
</div>
</div>
<ul>
{buckets.map((e)=>
<li key={e}>
<Link to={`/f/${e}/`} >{e}</Link>
</li>
)}
</ul>
</div>
)
}
export default BucketSelect

View File

@ -107,7 +107,7 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
await handleDrop(files) await handleDrop(files)
}} }}
> >
<div className="flex justify-between"> <div className="flex justify-between h-12">
<Breadcrum path={path} onDirClick={(newPath)=>{ <Breadcrum path={path} onDirClick={(newPath)=>{
props.history.push(newPath.toURI()) props.history.push(newPath.toURI())
}}/> }}/>