-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add systems and components * Maybe this way to rename? * Moved handler so can click if there is no text For example if user names it whitespace it can be hard to rename * Sveltify and add description * Color options Systems and Components files are almost identical * Type * Merge components and systems into 1 file * Drop down menu for project items * Delete ComponentDropDownMenu.svelte * Update ProjectItemDropDownMenu.svelte * Fix periodic check binding in ProjectItems and add dynamic class to ProjectItem * 40 Implemented dynamic global css variables (#89) * Implemented everything I made a huge mistake and merge comitted the branch linked to issue #50 into my original CSS branch. This included every individual commits from the other branch into my CSS branch. I tried to revert it but failed and was therefore forced to use this solution. * Added dark mode color to edges * Created a CSS variable support check This makes sure that no unsupported CSS variables are used. The supported CSS variables are specified in CSSVariables.ts * Changed resizer size * Removed unnecessary media schemes * Removed mediaFeature check * Corrrect the parsed error type * Removed the passing of the global window variable * Removed the need for range checking by using zod * Improved the zod schemes The zod schemes now enforce: - The color value range - That the "default" mediascheme contains a specification of all specified CSS variables and more... * Fix typo * Did some color styling to the navbar * Add IDs to add component and add system buttons in ProjectNav component * css variables * Update project item and dropdown menu components Co-authored-by: Nyby <[email protected]> * Remove unused imports and clean up code. * Fix tests and add new ones Co-authored-by: Nyby <[email protected]> * lint --------- Co-authored-by: Skrome <[email protected]> Co-authored-by: Nyby <[email protected]> Co-authored-by: Bastian Brix <[email protected]> Co-authored-by: Nyby <[email protected]>
- Loading branch information
1 parent
c576b2f
commit df1616e
Showing
13 changed files
with
479 additions
and
189 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<script lang="ts"> | ||
import { | ||
Folder_special, | ||
Request_page, | ||
} from "svelte-google-materialdesign-icons"; | ||
import ProjectItemDropDownMenu from "./ProjectItemDropDownMenu.svelte"; | ||
export let name: string; | ||
export let description: string; | ||
export let color: string; | ||
export let includeInPeriodicCheck: boolean = false; | ||
export let index: number; | ||
export let itemType: "system" | "component"; | ||
function handleDoubleClick() { | ||
name = prompt("New name:", name) || name; | ||
} | ||
</script> | ||
|
||
<div class="project-item {itemType}" id="{itemType}-{index}"> | ||
<div | ||
class="left" | ||
on:dblclick={handleDoubleClick} | ||
role="button" | ||
tabindex="-1" | ||
> | ||
<div class="circle" style="background-color: {color}"> | ||
<div class="icon"> | ||
{#if itemType === "component"} | ||
<Folder_special size="100%" /> | ||
{:else} | ||
<Request_page size="100%" /> | ||
{/if} | ||
</div> | ||
</div> | ||
<p>{name}</p> | ||
</div> | ||
<div> | ||
{#if itemType === "component"} | ||
<ProjectItemDropDownMenu | ||
bind:description | ||
bind:color | ||
bind:includeInPeriodicCheck | ||
{index} | ||
{itemType} | ||
/> | ||
{:else} | ||
<ProjectItemDropDownMenu | ||
bind:description | ||
bind:color | ||
{index} | ||
{itemType} | ||
/> | ||
{/if} | ||
</div> | ||
</div> | ||
|
||
<style> | ||
.left { | ||
display: flex; | ||
align-items: center; | ||
width: 100%; | ||
} | ||
.project-item { | ||
background-color: var(--sidebar-element-color); | ||
cursor: pointer; | ||
display: flex; | ||
justify-content: flex-start; | ||
align-items: center; | ||
padding: 10px; | ||
border-bottom: 1px solid black; | ||
transition: background-color 200ms; | ||
} | ||
.project-item:hover { | ||
background-color: var(--sidebar-element-hover-color); | ||
} | ||
.icon { | ||
display: flex; | ||
vertical-align: middle; | ||
padding: 15%; | ||
} | ||
.circle { | ||
margin-right: 10px; | ||
display: flex; | ||
height: 50px; | ||
width: 50px; | ||
min-width: 50px; | ||
border-radius: 70px; | ||
justify-content: center; | ||
} | ||
</style> |
137 changes: 137 additions & 0 deletions
137
src/lib/components/project/ProjectItemDropDownMenu.svelte
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,137 @@ | ||
<script lang="ts"> | ||
import { | ||
More_vert, | ||
Delete, | ||
Check_box, | ||
Check_box_outline_blank, | ||
} from "svelte-google-materialdesign-icons"; | ||
import { systems, components } from "$lib/globalState/activeProject"; | ||
import OverlayMenu from "$lib/components/overlayMenu/OverlayMenu.svelte"; | ||
import Panel from "$lib/components/overlayMenu/Panel.svelte"; | ||
import Button from "$lib/components/overlayMenu/elements/Button.svelte"; | ||
export let description: string; | ||
export let color: string; | ||
export let includeInPeriodicCheck: boolean = false; | ||
export let index: number; | ||
export let itemType: "system" | "component"; | ||
const colorOptions = [ | ||
"grey", | ||
"orange", | ||
"red", | ||
"pink", | ||
"purple", | ||
"blue", | ||
"skyblue", | ||
"cyan", | ||
"green", | ||
"brown", | ||
]; | ||
const menuId = `${itemType}-menu-${index}`; | ||
let button: HTMLElement; | ||
function togglePeriodicCheck(event: MouseEvent) { | ||
event.stopPropagation(); | ||
includeInPeriodicCheck = !includeInPeriodicCheck; | ||
} | ||
</script> | ||
|
||
<button | ||
class="dropdown" | ||
bind:this={button} | ||
popovertarget={menuId} | ||
id={`${itemType}-button-${index}`} | ||
> | ||
<More_vert /> | ||
</button> | ||
<OverlayMenu anchor={button} id={menuId}> | ||
{#if itemType === "component"} | ||
<Panel> | ||
<p>Configuration</p> | ||
{#if includeInPeriodicCheck} | ||
<Button | ||
icon={Check_box} | ||
text="Include in periodic check" | ||
click={togglePeriodicCheck} | ||
/> | ||
{:else} | ||
<Button | ||
icon={Check_box_outline_blank} | ||
text="Include in periodic check" | ||
click={togglePeriodicCheck} | ||
/> | ||
{/if} | ||
</Panel> | ||
{/if} | ||
<Panel> | ||
<p>Description</p> | ||
<input type="text" bind:value={description} on:click|stopPropagation /> | ||
</Panel> | ||
<Panel> | ||
<div class="colors"> | ||
{#each colorOptions as colorOption} | ||
<button | ||
style="background-color: {colorOption}" | ||
class="color" | ||
on:click={() => { | ||
color = colorOption; | ||
}} | ||
/> | ||
{/each} | ||
</div> | ||
</Panel> | ||
<Panel> | ||
<Button | ||
icon={Delete} | ||
text="Delete" | ||
click={() => { | ||
// this is switch because it will support more than 2 in the future | ||
switch (itemType) { | ||
case "system": | ||
$systems?.splice(index, 1); | ||
$systems = $systems; | ||
break; | ||
case "component": | ||
$components?.splice(index, 1); | ||
$components = $components; | ||
break; | ||
default: | ||
break; | ||
} | ||
}} | ||
/> | ||
</Panel> | ||
</OverlayMenu> | ||
|
||
<style> | ||
button { | ||
color: var(--sidebar-text-color); | ||
padding: 0; | ||
} | ||
p { | ||
margin: 0.5em 0; | ||
} | ||
.dropdown { | ||
background: none; | ||
border: none; | ||
cursor: pointer; | ||
} | ||
.colors { | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 5px; | ||
} | ||
.color { | ||
display: inline-block; | ||
border: none; | ||
height: 2em; | ||
width: 2em; | ||
border-radius: 100%; | ||
} | ||
</style> |
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,24 @@ | ||
<script lang="ts"> | ||
import ProjectItem from "./ProjectItem.svelte"; | ||
import { systems, components } from "$lib/globalState/activeProject"; | ||
</script> | ||
|
||
{#each $components || [] as component, index} | ||
<ProjectItem | ||
bind:name={component.name} | ||
bind:description={component.description} | ||
bind:color={component.color} | ||
bind:includeInPeriodicCheck={component.includeInPeriodicCheck} | ||
itemType="component" | ||
{index} | ||
/> | ||
{/each} | ||
{#each $systems || [] as system, index} | ||
<ProjectItem | ||
bind:name={system.name} | ||
bind:description={system.description} | ||
bind:color={system.color} | ||
itemType="system" | ||
{index} | ||
/> | ||
{/each} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.