fix: fix layout issue on mobile browser

This commit is contained in:
Khairul Hidayat 2024-08-21 07:05:35 +07:00
parent 4861e1bbb1
commit 7532c6330c
5 changed files with 18 additions and 9 deletions

View File

@ -21,7 +21,7 @@ const MainLayout = () => {
<Drawer <Drawer
open={sidebar.isOpen} open={sidebar.isOpen}
onClickOverlay={sidebar.onClose} onClickOverlay={sidebar.onClose}
className="md:drawer-open h-screen" className="md:drawer-open h-screen max-h-dvh"
side={<Sidebar />} side={<Sidebar />}
contentClassName="flex flex-col overflow-hidden" contentClassName="flex flex-col overflow-hidden"
> >

View File

@ -13,9 +13,10 @@ import { shareDialog } from "./share-dialog";
type Props = { type Props = {
prefix?: string; prefix?: string;
object: Pick<Object, "objectKey" | "downloadUrl">; object: Pick<Object, "objectKey" | "downloadUrl">;
end?: boolean;
}; };
const ObjectActions = ({ prefix = "", object }: Props) => { const ObjectActions = ({ prefix = "", object, end }: Props) => {
const { bucketName } = useBucketContext(); const { bucketName } = useBucketContext();
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const isDirectory = object.objectKey.endsWith("/"); const isDirectory = object.objectKey.endsWith("/");
@ -45,12 +46,12 @@ const ObjectActions = ({ prefix = "", object }: Props) => {
<Button icon={DownloadIcon} color="ghost" onClick={onDownload} /> <Button icon={DownloadIcon} color="ghost" onClick={onDownload} />
)} )}
<Dropdown end> <Dropdown end vertical={end ? "top" : "bottom"}>
<Dropdown.Toggle button={false}> <Dropdown.Toggle button={false}>
<Button icon={EllipsisVertical} color="ghost" /> <Button icon={EllipsisVertical} color="ghost" />
</Dropdown.Toggle> </Dropdown.Toggle>
<Dropdown.Menu className="bg-base-300 gap-y-1"> <Dropdown.Menu className="gap-y-1">
<Dropdown.Item <Dropdown.Item
onClick={() => onClick={() =>
shareDialog.open({ key: object.objectKey, prefix }) shareDialog.open({ key: object.objectKey, prefix })

View File

@ -23,7 +23,7 @@ const ObjectList = ({ prefix, onPrefixChange }: Props) => {
}; };
return ( return (
<div className="overflow-x-auto pb-32"> <div className="overflow-x-auto overflow-y-hidden">
<Table> <Table>
<Table.Head> <Table.Head>
<span>Name</span> <span>Name</span>
@ -63,7 +63,7 @@ const ObjectList = ({ prefix, onPrefixChange }: Props) => {
</tr> </tr>
))} ))}
{data?.objects.map((object) => { {data?.objects.map((object, idx) => {
const extIdx = object.objectKey.lastIndexOf("."); const extIdx = object.objectKey.lastIndexOf(".");
const filename = const filename =
extIdx >= 0 extIdx >= 0
@ -93,7 +93,11 @@ const ObjectList = ({ prefix, onPrefixChange }: Props) => {
<td className="whitespace-nowrap"> <td className="whitespace-nowrap">
{dayjs(object.lastModified).fromNow()} {dayjs(object.lastModified).fromNow()}
</td> </td>
<ObjectActions prefix={data.prefix} object={object} /> <ObjectActions
prefix={data.prefix}
object={object}
end={idx >= data.objects.length - 2}
/>
</tr> </tr>
); );
})} })}

View File

@ -184,7 +184,7 @@ const NodesList = ({ nodes }: NodeListProps) => {
</Alert> </Alert>
) : null} ) : null}
<div className="w-full overflow-x-auto min-h-[400px] pb-16"> <div className="w-full overflow-x-auto overflow-y-hidden min-h-[400px]">
<Table size="sm" className="min-w-[800px]"> <Table size="sm" className="min-w-[800px]">
<Table.Head> <Table.Head>
<span>#</span> <span>#</span>
@ -266,7 +266,10 @@ const NodesList = ({ nodes }: NodeListProps) => {
: "Inactive"} : "Inactive"}
</Badge> </Badge>
<Dropdown end> <Dropdown
end
vertical={idx >= items.length - 2 ? "top" : "bottom"}
>
<Dropdown.Toggle button={false}> <Dropdown.Toggle button={false}>
<Button shape="circle" color="ghost"> <Button shape="circle" color="ghost">
<EllipsisVertical /> <EllipsisVertical />

View File

@ -96,6 +96,7 @@ const KeysPage = () => {
icon={Eye} icon={Eye}
size="sm" size="sm"
onClick={() => fetchSecretKey(key.id)} onClick={() => fetchSecretKey(key.id)}
className="shrink-0 min-w-[80px]"
> >
View View
</Button> </Button>