-
Notifications
You must be signed in to change notification settings - Fork 8
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 #74 from ya-erm/dev
Additional options for operation - duplicate
- Loading branch information
Showing
12 changed files
with
186 additions
and
19 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<script lang="ts"> | ||
import type { TransactionViewModel } from '$lib/data/interfaces'; | ||
import { copyOperation, deleteOperation } from '$lib/data/operations'; | ||
import { translate } from '$lib/translate'; | ||
import Button from '$lib/ui/Button.svelte'; | ||
import Icon from '$lib/ui/Icon.svelte'; | ||
import Modal from '$lib/ui/Modal.svelte'; | ||
import { showSuccessToast } from '$lib/ui/toasts'; | ||
export let opened: boolean; | ||
export let operation: TransactionViewModel; | ||
const onClose = () => (opened = false); | ||
const handleDuplicate = () => { | ||
copyOperation(operation); | ||
onClose(); | ||
}; | ||
const handleDelete = () => { | ||
deleteOperation(operation.id); | ||
showSuccessToast($translate('transactions.delete_transaction_success'), { | ||
testId: 'DeleteTransactionSuccessToast', | ||
}); | ||
onClose(); | ||
}; | ||
</script> | ||
|
||
<Modal bind:opened header={$translate('common.additional_options')}> | ||
<div class="flex-col gap-1"> | ||
<Button appearance="transparent" bordered on:click={handleDuplicate}> | ||
<Icon name="mdi:content-copy" /> | ||
<span>{$translate('common.duplicate')}</span> | ||
</Button> | ||
<Button color="danger" appearance="transparent" bordered on:click={handleDelete}> | ||
<Icon name="mdi:delete-outline" /> | ||
<span>{$translate('common.delete')}</span> | ||
</Button> | ||
<Button color="white" bordered on:click={onClose}> | ||
<span>{$translate('common.cancel')}</span> | ||
</Button> | ||
</div> | ||
</Modal> |
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
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,21 +1,30 @@ | ||
<script lang="ts"> | ||
import { type ComponentProps } from 'svelte'; | ||
import MultiSwitch from '$lib/ui/MultiSwitch.svelte'; | ||
import Checkbox from '$lib/ui/Checkbox.svelte'; | ||
let sameSize = false; | ||
const options = [ | ||
const options: ComponentProps<MultiSwitch>['options'] = [ | ||
{ id: '1', title: 'First' }, | ||
{ id: '2', title: 'Second' }, | ||
{ id: '3', title: 'Third' }, | ||
]; | ||
let selected = options[0]; | ||
const optionsWithIcons: ComponentProps<MultiSwitch>['options'] = [ | ||
{ id: '1', icon: 'mdi:number-one-circle-outline', title: 'First' }, | ||
{ id: '2', icon: 'mdi:number-two-circle-outline', title: 'Second' }, | ||
{ id: '3', icon: 'mdi:number-three-circle-outline', title: 'Third' }, | ||
]; | ||
</script> | ||
|
||
<h2>MultiSwitch</h2> | ||
<div class="flex-col gap-1 items-start"> | ||
<div> | ||
<MultiSwitch options={options.slice(0, 2)} {selected} onChange={(item) => (selected = item)} /> | ||
</div> | ||
<div> | ||
<MultiSwitch {options} {selected} onChange={(item) => (selected = item)} /> | ||
</div> | ||
<Checkbox bind:checked={sameSize} label="same size" /> | ||
<MultiSwitch bind:selected options={options.slice(0, 2)} {sameSize} /> | ||
<MultiSwitch bind:selected {options} {sameSize} /> | ||
<MultiSwitch bind:selected options={optionsWithIcons} {sameSize} /> | ||
</div> |