aboutsummaryrefslogtreecommitdiff
path: root/src/components/EditorLists.svelte
blob: 1fc484b4351766a5aebba2415b64691ff2fa65f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<script lang="ts">
  import IconButton from "@smui/icon-button";
  import List, {
    Item,
    Meta,
    PrimaryText,
    SecondaryText,
    Text,
  } from "@smui/list";
  import { labStore, ptStore } from "../stores";

  $: peerTeachers = [...$ptStore.values()].sort((a, b) =>
    a.lastname.toUpperCase() === b.lastname.toUpperCase()
      ? a.firstname.toUpperCase().localeCompare(b.firstname.toUpperCase())
      : a.lastname.toUpperCase().localeCompare(b.lastname.toUpperCase())
  );

  $: labs = [...$labStore.values()].sort((a, b) => a.id - b.id);

  const nothing: any[] = [];
</script>

<div id="editor-lists">
  <div class="column">
    <h3 class="col-header">Peer Teachers</h3>
    <List twoline singleSelection class="editor-list">
      {#each peerTeachers as pt}
        <Item>
          <Text>
            <PrimaryText>{pt.firstname} {pt.lastname}</PrimaryText>
            <SecondaryText>{pt.id}</SecondaryText>
          </Text>
          <Meta>
            <IconButton
              class="material-icons"
              on:click$stopPropagation={() => {
                ptStore.update((val) => {
                  val.delete(pt.id);
                  return val;
                });
              }}>remove_circle</IconButton
            >
          </Meta>
        </Item>
      {/each}
    </List>
  </div>
  <div class="column">
    <h3 class="col-header">Labs</h3>
    <List twoline singleSelection class="editor-list">
      {#each labs as lab}
        <Item>
          <Text>
            <PrimaryText>{lab.course}-{lab.section} [{lab.time}]</PrimaryText>
            <SecondaryText>
              {lab.location}
            </SecondaryText>
          </Text>
          <Meta class="material-icons"
            ><IconButton
              class="material-icons"
              on:click$stopPropagation={() => {
                console.log("hello");
              }}>add_circle</IconButton
            ></Meta
          >
        </Item>
      {/each}
    </List>
  </div>
  <div class="column">
    <h3 class="col-header">PT - Assigned Labs</h3>
    <List twoline singleSelection class="editor-list">
      {#each nothing as n}
        <Item>
          <Text>
            <PrimaryText>{n.course} {n.section}</PrimaryText>
            <SecondaryText>
              {n.event.days}
              {n.event.start}-{n.event.end}
            </SecondaryText>
          </Text>
          <Meta class="material-icons"
            ><IconButton
              class="material-icons"
              on:click$stopPropagation={() => {
                console.log("hello");
              }}>remove_circle</IconButton
            ></Meta
          >
        </Item>
      {/each}
    </List>
  </div>
</div>

<style>
  #editor-lists {
    display: flex;
    max-height: inherit;
    min-height: 0;
    overflow-x: auto;
  }

  .col-header {
    font-family: Roboto, sans-serif;
  }

  .column {
    flex: 1;
    min-width: 15em;
    overflow: auto;
  }

  * :global(.editor-list) {
    border: 1px solid black;
  }
</style>