Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"deploy": "npx gh-pages -d dist"
"deploy": "npx gh-pages -d dist -b gh-pages"
},
"devDependencies": {
"@iconify/icons-ic": "^1.2.11",
Expand Down
11 changes: 6 additions & 5 deletions src/lib/CounterApp/CounterApp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ function save_data(data: any) {
anything_changed = false;
}
//#endregion

// @ts-ignore
$: counters_data, (anything_changed = true);

//#region variables initialize
Expand All @@ -34,13 +36,14 @@ $: {
if (anything_changed == false) {
break $;
} else {
anything_changed =
anything_changed = // @ts-ignore
Array.from(counters_saved) === Array.from(counters_data) ? false : true;
}
}

onMount(() => {
if (localStorage.getItem("counters_saved") !== null) {
// @ts-ignore
counters_data = Array.from(get(counters_saved));
counter_count = counters_data[counters_data.length - 1].id;
}
Expand Down Expand Up @@ -110,13 +113,11 @@ function handle_save() {

<div
class="flex-row p-4 pt-2 inline-flex flex-wrap gap-3 justify-evenly"
transition:fade
in:slide="{{ duration: 0 }}"
out:slide="{{ duration: 0 }}"
on:introend="{() => {
anim_long = false;
}}"
on:outroend="{() => {
anim_long = true;
}}"
>
{#each counters_data as item, i (item.id)}
<div in:slide="{{ delay: anim_long ? i * 100 : 0 }}" out:slide|local>
Expand Down
195 changes: 99 additions & 96 deletions src/lib/CounterApp/components/CounterTopBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,110 +37,113 @@ let dispatch = createEventDispatcher();
export let noOfCounters: number;
</script>

<div
class="p-4 bg-gray-200 dark:bg-gray-900 h-fit w-full sticky top-0 z-10 shadow"
>
<div class="flex justify-between">
<div class="flex gap-1">
<!-- options dropdown -->
<ToolbarButton
class="options_dropdown text-gray-900 bg-white dark:text-white dark:bg-gray-800 aspect-square"
>
<span class="fas fa-bars flex-grow px-2"></span>
</ToolbarButton>
<!-- dropdown elements -->
<Dropdown
transition="{slide}"
triggeredBy=".options_dropdown"
class="w-fit noselect"
>
<DropdownItem>
<Toggle size="small" bind:checked="{$delete_mode}"
>Delete mode
</Toggle>
</DropdownItem>
<DropdownItem>
<Toggle size="small" bind:checked="{$rename_mode}"
>Rename mode
</Toggle>
</DropdownItem>
<DropdownDivider />
<div transition:slide>
<div
class="p-4 bg-gray-200 dark:bg-gray-900 h-fit w-full sticky top-0 z-10 shadow"
>
<div class="flex justify-between">
<div class="flex gap-1">
<!-- options dropdown -->
<ToolbarButton
class="options_dropdown text-gray-900 bg-white dark:text-white dark:bg-gray-800 aspect-square"
>
<span class="fas fa-bars flex-grow px-2"></span>
</ToolbarButton>
<!-- dropdown elements -->
<Dropdown
transition="{slide}"
triggeredBy=".options_dropdown"
class="w-fit noselect"
>
<DropdownItem>
<Toggle size="small" bind:checked="{$delete_mode}"
>Delete mode
</Toggle>
</DropdownItem>
<DropdownItem>
<Toggle size="small" bind:checked="{$rename_mode}"
>Rename mode
</Toggle>
</DropdownItem>
<DropdownDivider />

<DropdownItem>
<Toggle size="small" bind:checked="{$smart_mode}" class="inline"
>Smart mode
</Toggle>
</DropdownItem>
<DropdownItem>
<Toggle size="small" bind:checked="{$smart_text}" class="inline"
>Smart text
</Toggle>
</DropdownItem>
<DropdownItem>
<Toggle size="small" bind:checked="{$minus_mode}">Minus mode</Toggle>
</DropdownItem>
<DropdownItem>
<Toggle size="small" bind:checked="{$smart_mode}" class="inline"
>Smart mode
</Toggle>
</DropdownItem>
<DropdownItem>
<Toggle size="small" bind:checked="{$smart_text}" class="inline"
>Smart text
</Toggle>
</DropdownItem>
<DropdownItem>
<Toggle size="small" bind:checked="{$minus_mode}">Minus mode</Toggle
>
</DropdownItem>

<DropdownItem>
<Toggle
size="small"
bind:checked="{$Counter_size_editing}"
class="inline"
>Edit Counters size
</Toggle>
</DropdownItem>
<DropdownItem>
<Toggle
size="small"
bind:checked="{$counter_id_shown}"
class="inline"
>
Show counter id
</Toggle>
</DropdownItem>
<DropdownDivider />
<DropdownItem>
<Toggle
size="small"
bind:checked="{$Counter_size_editing}"
class="inline"
>Edit Counters size
</Toggle>
</DropdownItem>
<DropdownItem>
<Toggle
size="small"
bind:checked="{$counter_id_shown}"
class="inline"
>
Show counter id
</Toggle>
</DropdownItem>
<DropdownDivider />

<!-- option: Reset all -->
<DropdownItem
on:click="{() => {
localStorage.clear();
dispatch('reset');
}}"
>
Reset all
</DropdownItem>
</Dropdown>
{#if $delete_mode}
<Button on:click="{() => ($delete_mode = false)}">
<Icon icon="{roundFileDownloadDone}" class="text-lg" />
</Button>
{:else if $Counter_size_editing}
<Button on:click="{() => ($Counter_size_editing = false)}">
<Icon icon="{roundFileDownloadDone}" class="text-lg" />
</Button>
{:else}
<div class="relative">
<Button
class="min-h-full overflow-visible"
<!-- option: Reset all -->
<DropdownItem
on:click="{() => {
dispatch('save_data');
localStorage.clear();
dispatch('reset');
}}"
>
<Icon icon="{contentSave}" class="text-lg" />
{#if !anything_changed}
<Icon icon="{doneRounded}" class=" absolute top-1 right-1 " />
{/if}
Reset all
</DropdownItem>
</Dropdown>
{#if $delete_mode}
<Button on:click="{() => ($delete_mode = false)}">
<Icon icon="{roundFileDownloadDone}" class="text-lg" />
</Button>
</div>
{/if}
</div>
{:else if $Counter_size_editing}
<Button on:click="{() => ($Counter_size_editing = false)}">
<Icon icon="{roundFileDownloadDone}" class="text-lg" />
</Button>
{:else}
<div class="relative">
<Button
class="min-h-full overflow-visible"
on:click="{() => {
dispatch('save_data');
}}"
>
<Icon icon="{contentSave}" class="text-lg" />
{#if !anything_changed}
<Icon icon="{doneRounded}" class=" absolute top-1 right-1 " />
{/if}
</Button>
</div>
{/if}
</div>

<div>
<Button
on:click="{() => {
noOfCounters += 1;
dispatch('create_counter');
}}">+1</Button
>
<div>
<Button
on:click="{() => {
noOfCounters += 1;
dispatch('create_counter');
}}">+1</Button
>
</div>
</div>
</div>
</div>
5 changes: 4 additions & 1 deletion src/lib/Home.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { P, Card, A, Hr } from "flowbite-svelte";
import { blur, slide } from "svelte/transition";
import { blur, fade, slide } from "svelte/transition";
// Icons loading
import Icon from "@iconify/svelte";
import counterIcon from "@iconify/icons-mdi/counter";
Expand Down Expand Up @@ -44,11 +44,14 @@ let pages = [
{/each}
</div>

<!-- some info -->
<div class="mt-8 text-right">
<P class="opacity-50">
Currently the Multi-Counter app is being developed. Timer app is just a
placeholder.
</P>

<!-- footnote -->
<Hr class="bg-gray-300" />
<A href="#/Designer">Green Room... for designing elements...</A><br />
<A href="#/Designer1">Error Link</A>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/loadingAnim.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fade } from "svelte/transition";

<div
out:fade
class="flex fixed w-screen h-80 flex-grow items-center justify-center"
class="absolute flex w-screen h-80 flex-grow items-center justify-center"
>
<SyncLoader color="green" />
</div>