From d0975a6e7ee57de4debda94e823011d813fbf4a1 Mon Sep 17 00:00:00 2001
From: Furkan Sahin <furkan-dev@proton.me>
Date: Sun, 5 Sep 2021 21:39:24 -0500
Subject: Initial rewrite in svelte

---
 src/components/ActionBar.vue | 85 --------------------------------------------
 1 file changed, 85 deletions(-)
 delete mode 100644 src/components/ActionBar.vue

(limited to 'src/components/ActionBar.vue')

diff --git a/src/components/ActionBar.vue b/src/components/ActionBar.vue
deleted file mode 100644
index bfe3cdb..0000000
--- a/src/components/ActionBar.vue
+++ /dev/null
@@ -1,85 +0,0 @@
-<template>
-  <div id="action-bar">
-    <FileUpload
-      :accept="'text/plain'"
-      :multiple="true"
-      @fileChanged="handlePtChange">Upload PT Schedule</FileUpload>
-    <FileUpload
-      :accept="'application/json'"
-      @fileChanged="handleLabChange">Import Lab Schedule</FileUpload>
-      <UIButton @click="save">Export</UIButton>
-  </div>
-</template>
-
-<script lang="ts">
-import { defineComponent } from 'vue';
-import FileUpload from '@/components/FileUpload.vue';
-import { parseLabFile, parsePtSchedule } from '@/features/parser';
-import UIButton from '@/components/UIButton.vue';
-import PeerTeacher from '@/models/PeerTeacher';
-
-export default defineComponent({
-  name: 'ActionBar',
-  components: {
-    FileUpload,
-    UIButton,
-  },
-  methods: {
-    async handleLabChange(files: File[]) {
-      const data = await parseLabFile(files[0]);
-      this.$store.commit('importLabs', data);
-    },
-    async handlePtChange(files: File[]) {
-      const promises: Promise<PeerTeacher>[] = [];
-
-      files.forEach((file) => {
-        promises.push(parsePtSchedule(file));
-      });
-
-      const result = await Promise.all(promises);
-      this.$store.commit('addPeerTeachers', result);
-    },
-    save() {
-      const database = {
-        labs: Object.fromEntries(this.$store.state.labs),
-        peerTeachers: Object.fromEntries(this.$store.state.peerTeachers),
-      };
-
-      const jsonObj = JSON.stringify(database, (_, value) => {
-        if (typeof value === 'object' && value instanceof Set) {
-          return [...value];
-        }
-        return value;
-      });
-
-      const blob = new Blob([jsonObj], { type: 'text/json' });
-      const anchor = document.createElement('a');
-      const url = window.URL.createObjectURL(blob);
-      anchor.href = url;
-      anchor.download = 'pt-db.json';
-      anchor.style.display = 'none';
-
-      document.body.appendChild(anchor);
-      anchor.click();
-      document.body.removeChild(anchor);
-      window.URL.revokeObjectURL(url);
-    },
-  },
-});
-</script>
-
-<style>
-#action-bar {
-  max-width: 100vw;
-  overflow-x: auto;
-  white-space: nowrap;
-}
-
-#action-bar > * {
-  margin-left: 0.5rem;
-}
-
-#action-bar > *:first-child {
-  margin-left: 0;
-}
-</style>
-- 
cgit v1.2.3

