chore: setup linting
This commit is contained in:
@@ -1,40 +1,37 @@
|
||||
<script lang="ts">
|
||||
import type { Graph } from "$lib/types";
|
||||
import { defaultPlant, plant, lottaFaces } from "$lib/graph-templates";
|
||||
import type { ProjectManager } from "./project-manager.svelte";
|
||||
import { defaultPlant, lottaFaces, plant } from '$lib/graph-templates';
|
||||
import type { Graph } from '$lib/types';
|
||||
import type { ProjectManager } from './project-manager.svelte';
|
||||
|
||||
const { projectManager } = $props<{ projectManager: ProjectManager }>();
|
||||
|
||||
let showNewProject = $state(false);
|
||||
let newProjectName = $state("");
|
||||
let selectedTemplate = $state("defaultPlant");
|
||||
let newProjectName = $state('');
|
||||
let selectedTemplate = $state('defaultPlant');
|
||||
|
||||
const templates = [
|
||||
{
|
||||
name: "Default Plant",
|
||||
value: "defaultPlant",
|
||||
graph: defaultPlant as unknown as Graph,
|
||||
name: 'Default Plant',
|
||||
value: 'defaultPlant',
|
||||
graph: defaultPlant as unknown as Graph
|
||||
},
|
||||
{ name: "Plant", value: "plant", graph: plant as unknown as Graph },
|
||||
{ name: 'Plant', value: 'plant', graph: plant as unknown as Graph },
|
||||
{
|
||||
name: "Lotta Faces",
|
||||
value: "lottaFaces",
|
||||
graph: lottaFaces as unknown as Graph,
|
||||
},
|
||||
name: 'Lotta Faces',
|
||||
value: 'lottaFaces',
|
||||
graph: lottaFaces as unknown as Graph
|
||||
}
|
||||
];
|
||||
|
||||
function handleCreate() {
|
||||
const template =
|
||||
templates.find((t) => t.value === selectedTemplate) || templates[0];
|
||||
const template = templates.find((t) => t.value === selectedTemplate) || templates[0];
|
||||
projectManager.handleCreateProject(template.graph, newProjectName);
|
||||
newProjectName = "";
|
||||
newProjectName = '';
|
||||
showNewProject = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<header
|
||||
class="flex justify-between px-4 h-[70px] border-b-1 border-[var(--outline)] items-center"
|
||||
>
|
||||
<header class="flex justify-between px-4 h-[70px] border-b-1 border-[var(--outline)] items-center">
|
||||
<h3>Project</h3>
|
||||
<button
|
||||
class="px-3 py-1 bg-[var(--layer-0)] rounded"
|
||||
@@ -51,13 +48,13 @@
|
||||
bind:value={newProjectName}
|
||||
placeholder="Project name"
|
||||
class="w-full px-2 py-2 bg-gray-800 border border-gray-700 rounded"
|
||||
onkeydown={(e) => e.key === "Enter" && handleCreate()}
|
||||
onkeydown={(e) => e.key === 'Enter' && handleCreate()}
|
||||
/>
|
||||
<select
|
||||
bind:value={selectedTemplate}
|
||||
class="w-full px-2 py-2 bg-gray-800 border border-gray-700 rounded"
|
||||
>
|
||||
{#each templates as template}
|
||||
{#each templates as template (template.name)}
|
||||
<option value={template.value}>{template.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
@@ -79,19 +76,21 @@
|
||||
{#each projectManager.projects as project (project.id)}
|
||||
<li>
|
||||
<div
|
||||
class="w-full text-left px-3 py-2 rounded cursor-pointer {projectManager
|
||||
class="
|
||||
w-full text-left px-3 py-2 rounded cursor-pointer {projectManager
|
||||
.activeProjectId.value === project.id
|
||||
? 'bg-blue-600'
|
||||
: 'bg-gray-800 hover:bg-gray-700'}"
|
||||
: 'bg-gray-800 hover:bg-gray-700'}
|
||||
"
|
||||
onclick={() => projectManager.handleSelectProject(project.id!)}
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onkeydown={(e) =>
|
||||
e.key === "Enter" &&
|
||||
projectManager.handleSelectProject(project.id!)}
|
||||
e.key === 'Enter'
|
||||
&& projectManager.handleSelectProject(project.id!)}
|
||||
>
|
||||
<div class="flex justify-between items-center">
|
||||
<span>{project.meta?.title || "Untitled"}</span>
|
||||
<span>{project.meta?.title || 'Untitled'}</span>
|
||||
<button
|
||||
class="text-red-400 hover:text-red-300"
|
||||
onclick={() => {
|
||||
|
||||
Reference in New Issue
Block a user