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
3 changes: 1 addition & 2 deletions src/lib/components/buttons/SvgButton.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import type { ComponentType } from "svelte";

export let click: (event: MouseEvent) => void = () => {};
export let icon: ComponentType;
export let id: string;
export let size: number = 24;
Expand All @@ -17,7 +16,7 @@
style="justify-content: {justifyContent}"
{id}
bind:this={button}
on:click={click}
on:click
{popovertarget}
>
<svelte:component
Expand Down
4 changes: 1 addition & 3 deletions src/lib/components/overlayMenu/elements/Button.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<script lang="ts">
import type { ComponentType } from "svelte";

export let click: (event: MouseEvent) => void;

export let icon: ComponentType;

export let text: string;
Expand All @@ -13,7 +11,7 @@
</script>

<button
on:click={click}
on:click
style="background-color: {backgroundColor}; color: {buttonColor}"
>
<svelte:component this={icon} ariaLabel="" class="icon" tabindex="-1" />
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/project/ProjectItemDropDownMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
? Check_box
: Check_box_outline_blank}
text="Include in periodic check"
click={togglePeriodicCheck}
on:click={togglePeriodicCheck}
/>
</Panel>
{/if}
Expand All @@ -94,7 +94,7 @@
<Button
icon={Delete}
text="Delete"
click={() => {
on:click={() => {
if (id instanceof SystemId) {
$systems?.delete(id);
$systems = $systems;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/project/ProjectNav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
<div class="buttons">
<SvgButton
icon={Create_new_folder}
click={addComponent}
on:click={addComponent}
size={30}
id="add-component"
/>
<SvgButton
icon={Note_add}
click={addSystem}
on:click={addSystem}
size={30}
id="add-system"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/query/Query.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<div class="group">
<SvgButton
icon={Arrow_right}
click={runQuery}
on:click={runQuery}
id="run-query"
color="var(--sidebar-text-color)"
/>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/query/QueryDropDownMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<Button
icon={isPeriodic ? Check_box : Check_box_outline_blank}
text="Run Periodically"
click={togglePeriodicCheck}
on:click={togglePeriodicCheck}
/>
</Panel>
<Panel>
Expand All @@ -50,7 +50,7 @@
<Button
icon={Delete}
text="Delete"
click={() => {
on:click={() => {
$queries?.splice(index, 1);
$queries = $queries;
}}
Expand Down
6 changes: 3 additions & 3 deletions src/lib/components/query/QueryNav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
<h1>Queries</h1>
</div>
<div class="buttons">
<SvgButton icon={Add} click={addQuery} size={30} id="add-query" />
<SvgButton icon={Add} on:click={addQuery} size={30} id="add-query" />
<SvgButton
icon={Arrow_right}
click={runAllQueries}
on:click={runAllQueries}
size={30}
id="run-all-queries"
/>
<SvgButton
icon={Menu}
click={resetAllStatus}
on:click={resetAllStatus}
size={30}
id="reset-all-status"
/>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/samplesImplementations/DropDownMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<button bind:this={button} popovertarget={menuId}>Files</button>
<OverlayMenu anchor={button} id={menuId}>
<Panel>
<Button icon={Download} text="Load" click={() => {}} />
<Button icon={Download} text="Load" on:click={() => {}} />
</Panel>
<Panel>
<Button icon={Save} text="Save" click={() => {}} />
<Button icon={Save} text="Save" on:click={() => {}} />
</Panel>
</OverlayMenu>
8 changes: 4 additions & 4 deletions src/lib/components/startScreen/StartScreen.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="flex-column">
<div class="bottom-border">
<SvgButton
click={startNewProject}
on:click={startNewProject}
icon={Add}
id={`start-new-project`}
color="var(--text-color)"
Expand All @@ -47,7 +47,7 @@
id={`open-example-${exampleName.replaceAll(" ", "-")}`}
color="var(--text-color)"
justifyContent="center"
click={async () => {
on:click={async () => {
await projectHandler.openExampleProject(
exampleLoader,
);
Expand All @@ -59,7 +59,7 @@
<div class="flex-column">
<div class="bottom-border">
<SvgButton
click={async () => {
on:click={async () => {
await projectHandler.openProject();
}}
icon={File_open}
Expand All @@ -78,7 +78,7 @@
id={`open-project`}
color="var(--text-color)"
justifyContent="center"
click={async () => {
on:click={async () => {
await projectHandler.openRecentProject(
recentProject,
);
Expand Down
51 changes: 27 additions & 24 deletions src/lib/components/topBar/DropDownCheckBox.svelte
Original file line number Diff line number Diff line change
@@ -1,56 +1,59 @@
<script lang="ts">
import { createEventDispatcher, type ComponentType } from "svelte";
import DropDownButton from "./DropDownButton.svelte";
import { Done } from "svelte-google-materialdesign-icons";
import { createEventDispatcher } from "svelte";
import Button from "$lib/components/overlayMenu/elements/Button.svelte";
import {
Check_box,
Check_box_outline_blank,
} from "svelte-google-materialdesign-icons";
/*import {
checkboxStates,
addCheckbox,
} from "$lib/globalState/topbarCheckBoxes";
} from "$lib/globalState/topbarCheckBoxes";*/

//Set dafult values
export let name: string = "Default";
let icon: ComponentType = Done;
//Set default values
export let text: string = "Default";
export let defaultVal: boolean = false;
let checked: boolean = defaultVal;
$: icon = checked ? Check_box : Check_box_outline_blank;
let unique = {};

addCheckbox(name, defaultVal);
checkboxStates[name].subscribe((value) => {
/*addCheckbox(text, defaultVal);
checkboxStates[text].subscribe((value) => {
checked = value;
});
});*/

const dispatch = createEventDispatcher();

function onCheck() {
checked = true;
//checkboxStates[text].set(true);
dispatch("checked");
}

function onUnCheck() {
checked = false;
//checkboxStates[text].set(false);
dispatch("unchecked");
}

function whatToCall(c: boolean) {
c ? onCheck() : onUnCheck();
function toggle() {
if (checked) {
onUnCheck();
} else {
onCheck();
}
}

whatToCall(checked);
toggle();
</script>

<!--Make each dropdown item, into button-->
{#key unique}
<DropDownButton
{name}
<Button
{text}
{icon}
color={checked ? "black" : "transparent"}
on:click={() => {
checkboxStates[name].update(() => {
if (checked) {
onUnCheck();
} else {
onCheck();
}
return !checked;
});
toggle();
unique = {};
}}
/>
Expand Down
Loading