Skip to content

Commit

Permalink
fix: some modal fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
n-peugnet committed Feb 21, 2022
1 parent a3b7204 commit 4a46bae
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
2 changes: 1 addition & 1 deletion public/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ div.file-table td:last-child {
}

div.file-table td .bx--overflow-menu {
width: 1rem;
width: 1.5rem;
}

.bx--data-table--md .bx--overflow-menu {
Expand Down
45 changes: 26 additions & 19 deletions src/view/FileList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@
newFolder = "";
}
async function renameFile() {
renameModal = false;
await fs.moveFile(
renameInode.path,
parent(renameInode.path) + renameValue
);
fileListUpdateIncr();
}
function copySelected() {
task = new CopyTask(fs, checked);
selectedRowIds = [];
Expand Down Expand Up @@ -205,8 +214,9 @@

<Modal
bind:open={newFolderModal}
size="xs"
size="sm"
modalHeading="Create new folder"
hasForm
primaryButtonText="Create"
primaryButtonDisabled={!newFolder}
secondaryButtonText="Cancel"
Expand All @@ -215,13 +225,11 @@
on:close={() => (newFolder = "")}
>
<p>Enter a name for the new folder.</p>
<Form on:submit={newDir}>
<TextInput
labelText="Name"
bind:value={newFolder}
data-modal-primary-focus
/>
</Form>
<TextInput
labelText="Name"
bind:value={newFolder}
data-modal-primary-focus
/>
</Modal>

<Modal
Expand All @@ -231,28 +239,27 @@
modalHeading="Delete selected files"
primaryButtonText="Delete"
secondaryButtonText="Cancel"
shouldSubmitOnEnter={false}
on:click:button--secondary={() => (deleteSelectedModal = false)}
on:submit={deleteSelected}
>
<p>Are you sure you want to delete {checked.length} files?</p>
</Modal>

<ComposedModal
bind:open={renameModal}
on:submit={() => {
fs.moveFile(renameInode.path, parent(renameInode.path) + renameValue).then(
fileListUpdateIncr
);
renameModal = false;
}}
>
<ComposedModal size="sm" bind:open={renameModal} on:submit={renameFile}>
<ModalHeader title="Rename file" />
<ModalBody hasForm>
<TextInput bind:value={renameValue} />
<Form on:submit={renameFile}>
<TextInput
labelText="New name"
bind:value={renameValue}
data-modal-primary-focus
/>
</Form>
</ModalBody>
<ModalFooter
primaryButtonText="Rename"
primaryButtonDisabled={renameValue.length <= 0}
primaryButtonDisabled={!renameValue}
secondaryButtonText="Cancel"
on:click:button--secondary={() => {
renameModal = false;
Expand Down

0 comments on commit 4a46bae

Please sign in to comment.