From c04946973e7cbb5f96b4f626458921ed713b2c48 Mon Sep 17 00:00:00 2001
From: Furkan Sahin <furkan-dev@proton.me>
Date: Tue, 26 Jul 2022 22:37:51 -0500
Subject: Editable PT name (wip), Download button for labs (doesn't function)

---
 src/components/PeerTeachers.svelte | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

(limited to 'src/components/PeerTeachers.svelte')

diff --git a/src/components/PeerTeachers.svelte b/src/components/PeerTeachers.svelte
index 16ff449..f0d34de 100644
--- a/src/components/PeerTeachers.svelte
+++ b/src/components/PeerTeachers.svelte
@@ -3,6 +3,7 @@
   import type PeerTeacher from "../models/PeerTeacher";
 
   let selected_pt: PeerTeacher | undefined;
+  let editing: boolean = false;
 
   $: peerTeachers = [...$ptStore.values()].sort((a, b) =>
     a.lastname.toUpperCase() === b.lastname.toUpperCase()
@@ -49,7 +50,20 @@
           class={selected_pt == pt ? "active" : "hover"}
         >
           <th>{i + 1}</th>
-          <th>{pt.firstname}</th>
+          <th>
+            {#if editing && selected_pt == pt}
+              <input
+                bind:value={pt.firstname}
+                type="text"
+                class="input input-bordered input-primary  w-full max-w-xs"
+                on:blur={() => (editing = false)}
+              />
+            {:else}
+              <div on:dblclick={() => (editing = true)}>
+                {pt.firstname}
+              </div>
+            {/if}
+          </th>
           <th>{pt.lastname}</th>
           <th>{pt.id}</th>
           <th>{pt.email}</th>
-- 
cgit v1.2.3

