Prechádzať zdrojové kódy

Continue working on project, add changing in workspace and some styles.

cixo 1 rok pred
rodič
commit
1627b429bb
3 zmenil súbory, kde vykonal 23 pridanie a 5 odobranie
  1. 8 4
      assets/core.js
  2. 8 0
      assets/project.js
  3. 7 1
      theme/workspace.css

+ 8 - 4
assets/core.js

@@ -39,11 +39,15 @@ document.addEventListener("DOMContentLoaded", async () => {
     const left_bar = left_bar_builder.element;
     left_bar.className = "left-bar";
 
-    const choose = new chooser(store, () => {});
-    left_bar.appendChild(choose.ui);
-
     const center = new workspace();
-    center.update(store.content.submissions[1]);
+    center.update(store.content.first_submission);
+
+    const workspace_updater = (target) => {
+        center.update(target);
+    };
+
+    const choose = new chooser(store, workspace_updater);
+    left_bar.appendChild(choose.ui);
 
     container.appendChild(top_bar);
     container.appendChild(left_bar);

+ 8 - 0
assets/project.js

@@ -36,6 +36,14 @@ class project {
         return Object.values(this.#submissions);
     }
 
+    get first_submission() {
+        if (this.submissions.length < 1) {
+            throw "In project must be minimum one submission to get first.";
+        }
+
+        return this.submissions[0];
+    }
+
     get(name) {
         if (typeof(name) !== "string") {
             throw "Name of submission must be an string.";

+ 7 - 1
theme/workspace.css

@@ -14,7 +14,7 @@
     flex-direction: row;
     flex-wrap: nowrap;
     justify-content: space-between;
-    align-items: center;
+    align-items: stretch;
 }
 
 .workspace .header p:first-child {
@@ -53,3 +53,9 @@
 .workspace .thumbnail:hover {
     transform: scale(1.5);
 }
+
+.workspace .right {
+    border-left: 3px solid var(--primary-color);
+    display: flex;
+    align-items: center;
+}