Compare commits
3 Commits
fcb34aeacc
...
6b8c922d5b
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b8c922d5b | |||
| 91e75a2c72 | |||
| fd688021ea |
@@ -49,7 +49,7 @@ const Breadcrum: React.FC<Props> = ({path,onDirClick}) => {
|
|||||||
className={`${last?"text-blue-500":""}`}
|
className={`${last?"text-blue-500":""}`}
|
||||||
onClick={()=>{
|
onClick={()=>{
|
||||||
if (!last){
|
if (!last){
|
||||||
onDirClick?.(new ObjID(path.bucket,"/"+arr.slice(0,i-1).join("/")))
|
onDirClick?.(new ObjID(path.bucket,arr.slice(0,i+1).join("/")))
|
||||||
}
|
}
|
||||||
}}>{e}</a>
|
}}>{e}</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Link } from "react-router-dom"
|
import { useHistory } from "react-router-dom"
|
||||||
import { useListBucktesQuery } from "../generated/graphql"
|
import { useListBucktesQuery } from "../generated/graphql"
|
||||||
import Breadcrum from "./Breadcrum"
|
import Breadcrum from "./Breadcrum"
|
||||||
import MoreMenu from "./MoreMenu"
|
import MoreMenu from "./MoreMenu"
|
||||||
import { ReactComponent as Spinner } from "./../assets/spinner.svg"
|
import { ReactComponent as Spinner } from "./../assets/spinner.svg"
|
||||||
|
import Table, { Data } from "./Table"
|
||||||
|
|
||||||
const BucketSelect: React.FC = () => {
|
const BucketSelect: React.FC = () => {
|
||||||
|
const history = useHistory()
|
||||||
const {data: buckets, loading} = useListBucktesQuery()
|
const {data: buckets, loading} = useListBucktesQuery()
|
||||||
|
const tableData: Data = {
|
||||||
|
headers:[{name:"Bucket"}],
|
||||||
|
body:(!buckets?[]:buckets.buckets.map(e=>{return {cells:[{name:e||""}],onClick:()=>{history.push(`/f/${e}`)}}}))
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -17,13 +22,7 @@ const BucketSelect: React.FC = () => {
|
|||||||
<MoreMenu />
|
<MoreMenu />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<Table data={tableData}/>
|
||||||
{buckets?.buckets.map((e)=>
|
|
||||||
<li key={e}>
|
|
||||||
<Link to={`/f/${e}/`} >{e}</Link>
|
|
||||||
</li>
|
|
||||||
)}
|
|
||||||
</ul>
|
|
||||||
{loading &&
|
{loading &&
|
||||||
<div className="flex justify-center mt-4">
|
<div className="flex justify-center mt-4">
|
||||||
<Spinner className="animate-spin h-6 w-6 dark:text-white" />
|
<Spinner className="animate-spin h-6 w-6 dark:text-white" />
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ const Table: React.FC<Props> = ({data:{headers,body}}) => {
|
|||||||
return (
|
return (
|
||||||
<table className="w-full">
|
<table className="w-full">
|
||||||
<thead className="border-b-2 dark:border-gray-900">
|
<thead className="border-b-2 dark:border-gray-900">
|
||||||
|
<tr>
|
||||||
{headers.map((e,i)=><th key={i} className="text-left">{e.name}</th>)}
|
{headers.map((e,i)=><th key={i} className="text-left">{e.name}</th>)}
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody className="divide-y dark:divide-gray-900">
|
<tbody className="divide-y dark:divide-gray-900">
|
||||||
{body.map((row,rowIndex)=>
|
{body.map((row,rowIndex)=>
|
||||||
|
|||||||
Reference in New Issue
Block a user