From 150fe9df52a25ee71fa6dc816e465e6a8edc627a Mon Sep 17 00:00:00 2001 From: Aydin Hassan Date: Wed, 17 Jan 2024 21:36:33 +0100 Subject: [PATCH 1/4] eslint --- .eslintrc.cjs | 17 + .prettierrc | 6 - .prettierrc.json | 8 + assets/app.js | 289 +- assets/components/Admin/AdminLayout.vue | 351 ++ assets/components/Admin/EmptyLayout.vue | 1 - assets/components/Admin/Events.vue | 421 --- assets/components/Admin/Home.vue | 8 - assets/components/Admin/Layout.vue | 210 -- assets/components/Admin/Login.vue | 60 - assets/components/Admin/NewWorkshops.vue | 160 - assets/components/Admin/PageEvents.vue | 659 ++++ assets/components/Admin/PageHome.vue | 8 + assets/components/Admin/PageLogin.vue | 83 + assets/components/Admin/PageNewWorkshops.vue | 238 ++ assets/components/Admin/PageSettings.vue | 75 + .../Admin/{Students.vue => PageStudents.vue} | 53 +- .../Admin/{Workshop.vue => PageWorkshop.vue} | 87 +- ...pInstalls.vue => PageWorkshopInstalls.vue} | 40 +- assets/components/Admin/PageWorkshops.vue | 463 +++ assets/components/Admin/Settings.vue | 54 - assets/components/Admin/Workshops.vue | 270 -- assets/components/Admin/api.js | 82 +- assets/components/Icons/GitHubIcon.vue | 15 +- assets/components/Online/AceEditor.vue | 179 +- assets/components/Online/Alert.vue | 51 - assets/components/Online/ComposerPackages.vue | 161 +- assets/components/Online/Confirm.vue | 117 - assets/components/Online/ConfirmDialog.vue | 140 + assets/components/Online/Dashboard.vue | 36 - .../components/Online/EditorBreadcrumbs.vue | 40 +- assets/components/Online/EditorTabs.vue | 66 + assets/components/Online/EditorTour.vue | 340 ++ assets/components/Online/ExerciseEditor.vue | 422 --- assets/components/Online/ExerciseEntry.vue | 55 +- assets/components/Online/ExerciseVerify.vue | 395 ++- assets/components/Online/FileTree.vue | 154 +- assets/components/Online/Modal.vue | 109 - assets/components/Online/ModalDialog.vue | 136 + assets/components/Online/PackageSearch.vue | 200 +- assets/components/Online/PageDashboard.vue | 33 + .../components/Online/PageExerciseEditor.vue | 492 +++ assets/components/Online/PassNotification.vue | 274 +- assets/components/Online/Problem.vue | 130 - assets/components/Online/ProblemFile.vue | 155 + assets/components/Online/ProgressBar.vue | 30 +- .../Online/Results/CgiOutputMismatch.vue | 116 - .../Results/CgiOutputMismatchResult.vue | 159 + assets/components/Online/Results/CgiRun.vue | 96 - .../Online/Results/CgiRunResult.vue | 128 + .../Online/Results/CliOutputMismatch.vue | 80 - .../Results/CliOutputMismatchResult.vue | 111 + assets/components/Online/Results/CliRun.vue | 106 - .../Online/Results/CliRunResult.vue | 132 + .../Online/Results/ComparisonFailure.vue | 80 - .../Results/ComparisonFailureResult.vue | 111 + .../Online/Results/ComposerFailure.vue | 84 - .../Online/Results/ComposerFailureResult.vue | 120 + assets/components/Online/Results/Failure.vue | 12 - .../Online/Results/FailureResult.vue | 11 + .../Online/Results/FileComparisonFailure.vue | 92 - .../Results/FileComparisonFailureResult.vue | 128 + .../Results/FunctionRequirementsFailure.vue | 85 - .../FunctionRequirementsFailureResult.vue | 122 + .../components/Online/Results/ResultList.vue | 61 +- assets/components/Online/Results/results.js | 38 +- assets/components/Online/RunResult.vue | 137 +- assets/components/Online/SiteAlert.vue | 72 + assets/components/Online/Stores/editor.js | 10 +- assets/components/Online/StudentDropdown.vue | 127 +- assets/components/Online/StudentProgress.vue | 100 +- assets/components/Online/Tabs.vue | 47 - assets/components/Online/Tour.vue | 331 -- assets/components/Online/TreeItem.vue | 296 +- assets/components/Online/Utils/debounce.js | 8 +- assets/components/Online/Utils/toFilePath.js | 12 +- assets/components/Online/Utils/uniqueName.js | 15 +- assets/components/Online/Utils/waitUntil.js | 10 +- .../Online/WorkshopExerciseSelectionList.vue | 243 +- assets/components/Website/App.vue | 7 +- assets/components/Website/Button.vue | 11 - assets/components/Website/CodeAnimation.vue | 63 +- assets/components/Website/CompactLayout.vue | 4 +- .../components/Website/Docs/BundledCheck.vue | 32 +- assets/components/Website/Docs/CodeBlock.vue | 75 +- .../components/Website/Docs/ContentHeader.vue | 48 +- .../Website/Docs/{Code.vue => DocCode.vue} | 0 .../Website/Docs/{List.vue => DocList.vue} | 10 +- .../Docs/{ListItem.vue => DocListItem.vue} | 2 +- .../Website/Docs/{Note.vue => DocNote.vue} | 22 +- assets/components/Website/Docs/DocTable.vue | 36 + .../components/Website/Docs/DocTerminal.vue | 80 + assets/components/Website/Docs/DocTitle.vue | 72 + .../Website/Docs/EventDescription.vue | 24 +- .../components/Website/Docs/ExerciseType.vue | 36 +- .../Website/Docs/ResultRendererMappings.vue | 13 +- .../Website/Docs/Sections/DocHome.vue | 29 + .../Website/Docs/Sections/Index.vue | 16 - .../Sections/Reference/AvailableServices.vue | 128 +- .../Docs/Sections/Reference/BundledChecks.vue | 198 +- .../Docs/Sections/Reference/CheckResults.vue | 306 ++ .../CreatingCustomResultRenderers.vue | 78 +- .../Reference/CreatingCustomResults.vue | 120 +- .../Reference/CreatingListenerChecks.vue | 733 ++-- .../Sections/Reference/EventDescription.vue | 24 +- .../Docs/Sections/Reference/EventSystem.vue | 845 +++++ .../Docs/Sections/Reference/Events.vue | 342 -- .../Sections/Reference/ExerciseChecks.vue | 147 +- .../Sections/Reference/ExerciseEvents.vue | 55 +- .../Sections/Reference/ExerciseSolutions.vue | 280 +- .../Docs/Sections/Reference/ExerciseTypes.vue | 163 +- .../Website/Docs/Sections/Reference/Index.vue | 59 - .../Reference/PatchingExerciseSolutions.vue | 151 +- .../Docs/Sections/Reference/ReferenceHome.vue | 128 + .../Docs/Sections/Reference/Results.vue | 196 -- .../Reference/SelfCheckingExercises.vue | 221 +- .../Docs/Sections/Reference/SimpleChecks.vue | 382 +- .../Docs/Sections/Reference/TheContainer.vue | 110 +- .../Sections/Tutorial/CreatingAnExercise.vue | 246 +- .../Tutorial/CreatingYourOwnWorkshop.vue | 111 +- .../Website/Docs/Sections/Tutorial/Index.vue | 17 - .../Docs/Sections/Tutorial/ModifyTheme.vue | 53 +- .../Docs/Sections/Tutorial/TutorialHome.vue | 34 + assets/components/Website/Docs/Table.vue | 31 - assets/components/Website/Docs/Terminal.vue | 64 - assets/components/Website/Docs/Title.vue | 34 - assets/components/Website/Docs/contents.js | 262 +- assets/components/Website/Logo.vue | 13 - .../Website/{Layout.vue => MainLayout.vue} | 6 +- .../Home/Heading.vue => PageHeading.vue} | 9 +- assets/components/Website/Pages/Docs.vue | 223 -- assets/components/Website/Pages/Events.vue | 82 - assets/components/Website/Pages/Home.vue | 304 -- assets/components/Website/Pages/Home/Hero.vue | 43 - .../Website/Pages/Home/HeroSection.vue | 48 + .../Website/Pages/Home/InfoSection.vue | 5 +- .../Website/Pages/Home/Mocks/MockEditor.vue | 366 +- .../Pages/Home/Mocks/MockOfficialSolution.vue | 89 +- .../Pages/Home/Mocks/MockPassNotification.vue | 67 +- .../Pages/Home/Mocks/MockProblemModal.vue | 217 +- .../Website/Pages/Home/Mocks/MockProgress.vue | 30 +- .../Website/Pages/Home/Mocks/MockResults.vue | 121 +- .../Home/Mocks/MockWorkshopExerciseList.vue | 125 +- .../Pages/Home/Mocks/MockWorkshopList.vue | 64 +- .../Pages/Home/Section/BuildYourOwn.vue | 52 +- .../Pages/Home/Section/GettingStarted.vue | 46 +- .../Website/Pages/Home/Section/Terminal.vue | 64 - .../Pages/Home/Section/TerminalSection.vue | 104 - .../Pages/Home/Section/TerminalStep.vue | 36 - .../Pages/Home/Section/TheWorkshops.vue | 52 +- assets/components/Website/Pages/Offline.vue | 25 - .../Website/Pages/Offline/TerminalDisplay.vue | 78 + .../Website/Pages/Offline/TerminalStep.vue | 39 + .../Pages/{BlogIndex.vue => PageBlog.vue} | 36 +- .../Pages/{BlogPost.vue => PageBlogPost.vue} | 41 +- assets/components/Website/Pages/PageDocs.vue | 263 ++ .../components/Website/Pages/PageEvents.vue | 137 + assets/components/Website/Pages/PageHome.vue | 308 ++ .../components/Website/Pages/PageOffline.vue | 151 + .../{Home/Section.vue => PageSection.vue} | 6 +- .../Website/Pages/PageSubmitWorkshop.vue | 302 ++ .../Website/Pages/SubmitWorkshop.vue | 184 - assets/components/Website/PrimaryButton.vue | 16 + assets/components/Website/SiteFooter.vue | 50 +- assets/components/Website/SiteLogo.vue | 42 + assets/components/Website/SiteNav.vue | 334 +- assets/helpers/highlightCode.js | 27 +- assets/index.html | 34 +- assets/result.manifest.json | 54 +- assets/shepherd-plugin.js | 28 +- assets/stores/admin.js | 52 +- assets/stores/blog.js | 21 +- assets/stores/events.js | 23 +- assets/stores/student.js | 102 +- assets/stores/workshops.js | 45 +- assets/styles/index.js | 6 +- assets/styles/online.css | 210 +- assets/styles/panda-syntax-dark.css | 2 +- jsconfig.json | 8 + package-lock.json | 3095 +++++++++-------- package.json | 13 +- public/img/icons/icons.svg | 423 --- public/img/icons/preview.html | 324 -- public/img/icons/svg4everybody.min.js | 1 - public/index.php | 1 - src/Blog/Post.php | 2 +- vite.config.js | 4 - 187 files changed, 14866 insertions(+), 10538 deletions(-) create mode 100644 .eslintrc.cjs delete mode 100644 .prettierrc create mode 100644 .prettierrc.json create mode 100644 assets/components/Admin/AdminLayout.vue delete mode 100644 assets/components/Admin/Events.vue delete mode 100644 assets/components/Admin/Home.vue delete mode 100644 assets/components/Admin/Layout.vue delete mode 100644 assets/components/Admin/Login.vue delete mode 100644 assets/components/Admin/NewWorkshops.vue create mode 100644 assets/components/Admin/PageEvents.vue create mode 100644 assets/components/Admin/PageHome.vue create mode 100644 assets/components/Admin/PageLogin.vue create mode 100644 assets/components/Admin/PageNewWorkshops.vue create mode 100644 assets/components/Admin/PageSettings.vue rename assets/components/Admin/{Students.vue => PageStudents.vue} (55%) rename assets/components/Admin/{Workshop.vue => PageWorkshop.vue} (63%) rename assets/components/Admin/{WorkshopInstalls.vue => PageWorkshopInstalls.vue} (65%) create mode 100644 assets/components/Admin/PageWorkshops.vue delete mode 100644 assets/components/Admin/Settings.vue delete mode 100644 assets/components/Admin/Workshops.vue delete mode 100644 assets/components/Online/Alert.vue delete mode 100644 assets/components/Online/Confirm.vue create mode 100644 assets/components/Online/ConfirmDialog.vue delete mode 100644 assets/components/Online/Dashboard.vue create mode 100644 assets/components/Online/EditorTabs.vue create mode 100644 assets/components/Online/EditorTour.vue delete mode 100644 assets/components/Online/ExerciseEditor.vue delete mode 100644 assets/components/Online/Modal.vue create mode 100644 assets/components/Online/ModalDialog.vue create mode 100644 assets/components/Online/PageDashboard.vue create mode 100644 assets/components/Online/PageExerciseEditor.vue delete mode 100644 assets/components/Online/Problem.vue create mode 100644 assets/components/Online/ProblemFile.vue delete mode 100644 assets/components/Online/Results/CgiOutputMismatch.vue create mode 100644 assets/components/Online/Results/CgiOutputMismatchResult.vue delete mode 100644 assets/components/Online/Results/CgiRun.vue create mode 100644 assets/components/Online/Results/CgiRunResult.vue delete mode 100644 assets/components/Online/Results/CliOutputMismatch.vue create mode 100644 assets/components/Online/Results/CliOutputMismatchResult.vue delete mode 100644 assets/components/Online/Results/CliRun.vue create mode 100644 assets/components/Online/Results/CliRunResult.vue delete mode 100644 assets/components/Online/Results/ComparisonFailure.vue create mode 100644 assets/components/Online/Results/ComparisonFailureResult.vue delete mode 100644 assets/components/Online/Results/ComposerFailure.vue create mode 100644 assets/components/Online/Results/ComposerFailureResult.vue delete mode 100644 assets/components/Online/Results/Failure.vue create mode 100644 assets/components/Online/Results/FailureResult.vue delete mode 100644 assets/components/Online/Results/FileComparisonFailure.vue create mode 100644 assets/components/Online/Results/FileComparisonFailureResult.vue delete mode 100644 assets/components/Online/Results/FunctionRequirementsFailure.vue create mode 100644 assets/components/Online/Results/FunctionRequirementsFailureResult.vue create mode 100644 assets/components/Online/SiteAlert.vue delete mode 100644 assets/components/Online/Tabs.vue delete mode 100644 assets/components/Online/Tour.vue delete mode 100644 assets/components/Website/Button.vue rename assets/components/Website/Docs/{Code.vue => DocCode.vue} (100%) rename assets/components/Website/Docs/{List.vue => DocList.vue} (58%) rename assets/components/Website/Docs/{ListItem.vue => DocListItem.vue} (88%) rename assets/components/Website/Docs/{Note.vue => DocNote.vue} (60%) create mode 100644 assets/components/Website/Docs/DocTable.vue create mode 100644 assets/components/Website/Docs/DocTerminal.vue create mode 100644 assets/components/Website/Docs/DocTitle.vue create mode 100644 assets/components/Website/Docs/Sections/DocHome.vue delete mode 100644 assets/components/Website/Docs/Sections/Index.vue create mode 100644 assets/components/Website/Docs/Sections/Reference/CheckResults.vue create mode 100644 assets/components/Website/Docs/Sections/Reference/EventSystem.vue delete mode 100644 assets/components/Website/Docs/Sections/Reference/Events.vue delete mode 100644 assets/components/Website/Docs/Sections/Reference/Index.vue create mode 100644 assets/components/Website/Docs/Sections/Reference/ReferenceHome.vue delete mode 100644 assets/components/Website/Docs/Sections/Reference/Results.vue delete mode 100644 assets/components/Website/Docs/Sections/Tutorial/Index.vue create mode 100644 assets/components/Website/Docs/Sections/Tutorial/TutorialHome.vue delete mode 100644 assets/components/Website/Docs/Table.vue delete mode 100644 assets/components/Website/Docs/Terminal.vue delete mode 100644 assets/components/Website/Docs/Title.vue delete mode 100644 assets/components/Website/Logo.vue rename assets/components/Website/{Layout.vue => MainLayout.vue} (72%) rename assets/components/Website/{Pages/Home/Heading.vue => PageHeading.vue} (68%) delete mode 100644 assets/components/Website/Pages/Docs.vue delete mode 100644 assets/components/Website/Pages/Events.vue delete mode 100644 assets/components/Website/Pages/Home.vue delete mode 100644 assets/components/Website/Pages/Home/Hero.vue create mode 100644 assets/components/Website/Pages/Home/HeroSection.vue delete mode 100644 assets/components/Website/Pages/Home/Section/Terminal.vue delete mode 100644 assets/components/Website/Pages/Home/Section/TerminalSection.vue delete mode 100644 assets/components/Website/Pages/Home/Section/TerminalStep.vue delete mode 100644 assets/components/Website/Pages/Offline.vue create mode 100644 assets/components/Website/Pages/Offline/TerminalDisplay.vue create mode 100644 assets/components/Website/Pages/Offline/TerminalStep.vue rename assets/components/Website/Pages/{BlogIndex.vue => PageBlog.vue} (54%) rename assets/components/Website/Pages/{BlogPost.vue => PageBlogPost.vue} (63%) create mode 100644 assets/components/Website/Pages/PageDocs.vue create mode 100644 assets/components/Website/Pages/PageEvents.vue create mode 100644 assets/components/Website/Pages/PageHome.vue create mode 100644 assets/components/Website/Pages/PageOffline.vue rename assets/components/Website/Pages/{Home/Section.vue => PageSection.vue} (75%) create mode 100644 assets/components/Website/Pages/PageSubmitWorkshop.vue delete mode 100644 assets/components/Website/Pages/SubmitWorkshop.vue create mode 100644 assets/components/Website/PrimaryButton.vue create mode 100644 assets/components/Website/SiteLogo.vue create mode 100644 jsconfig.json delete mode 100644 public/img/icons/icons.svg delete mode 100644 public/img/icons/preview.html delete mode 100644 public/img/icons/svg4everybody.min.js diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 00000000..867eec33 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,17 @@ +/* eslint-env node */ +require('@rushstack/eslint-patch/modern-module-resolution') + +module.exports = { + root: true, + 'extends': [ + 'plugin:vue/vue3-essential', + 'eslint:recommended', + '@vue/eslint-config-prettier/skip-formatting' + ], + parserOptions: { + ecmaVersion: 'latest' + }, + env: { + node: true + } +} diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index bd08d66e..00000000 --- a/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "singleQuote": true, - "semi": false, - "tabWidth": 2 - -} diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..24f1a242 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/prettierrc", + "semi": false, + "tabWidth": 4, + "singleQuote": true, + "printWidth": 100, + "trailingComma": "none" +} \ No newline at end of file diff --git a/assets/app.js b/assets/app.js index de279f91..232be9e5 100644 --- a/assets/app.js +++ b/assets/app.js @@ -1,135 +1,216 @@ import 'vite/modulepreload-polyfill' import './styles' import { FocusTrap } from 'focus-trap-vue' -import VueClickAway from "vue3-click-away"; -import VueDiff from 'vue-diff'; -import 'vue-diff/dist/index.css'; -import {markRaw} from "vue"; -import VueShepherdPlugin from './shepherd-plugin'; -import results from "./components/Online/Results/results.js"; -import Home from "./components/Website/Pages/Home.vue"; -import SubmitWorkshop from "./components/Website/Pages/SubmitWorkshop.vue"; - -import Offline from "./components/Website/Pages/Offline.vue"; -import Docs from "./components/Website/Pages/Docs.vue"; - -import App from "./components/Website/App.vue"; - -import {docs} from "./components/Website/Docs/contents.js"; -import Layout from "./components/Website/Layout.vue"; -import CompactLayout from "./components/Website/CompactLayout.vue"; - -import Dashboard from "./components/Online/Dashboard.vue"; -import Events from "./components/Website/Pages/Events.vue"; -import BlogIndex from "./components/Website/Pages/BlogIndex.vue"; -import BlogPost from "./components/Website/Pages/BlogPost.vue"; -import Terminal from "./components/Website/Docs/Terminal.vue"; -import {ViteSSG} from "vite-ssg"; +import VueClickAway from 'vue3-click-away' +import VueDiff from 'vue-diff' +import 'vue-diff/dist/index.css' +import { markRaw } from 'vue' +import VueShepherdPlugin from './shepherd-plugin' +import results from './components/Online/Results/results.js' +import Home from './components/Website/Pages/PageHome.vue' +import SubmitWorkshop from './components/Website/Pages/PageSubmitWorkshop.vue' + +import Offline from './components/Website/Pages/PageOffline.vue' +import Docs from './components/Website/Pages/PageDocs.vue' + +import App from './components/Website/App.vue' + +import { docs } from './components/Website/Docs/contents.js' +import MainLayout from './components/Website/MainLayout.vue' +import CompactLayout from './components/Website/CompactLayout.vue' + +import Dashboard from './components/Online/PageDashboard.vue' +import Events from './components/Website/Pages/PageEvents.vue' +import BlogIndex from './components/Website/Pages/PageBlog.vue' +import BlogPost from './components/Website/Pages/PageBlogPost.vue' +import { ViteSSG } from 'vite-ssg' import { createPinia } from 'pinia' -import {useBlogStore} from "./stores/blog"; -import {useEventStore} from "./stores/events"; - -import {useAdminStore} from "./stores/admin"; -import AdminLayout from "./components/Admin/Layout.vue"; -import EmptyAdminLayout from "./components/Admin/EmptyLayout.vue"; -import AdminLogin from "./components/Admin/Login.vue"; -import AminHome from "./components/Admin/Home.vue"; -import AdminWorkshops from "./components/Admin/Workshops.vue"; -import AdminWorkshop from "./components/Admin/Workshop.vue"; -import AdminWorkshopInstalls from "./components/Admin/WorkshopInstalls.vue"; -import AdminNewWorkshops from "./components/Admin/NewWorkshops.vue"; -import AdminStudents from "./components/Admin/Students.vue"; -import AdminSettings from "./components/Admin/Settings.vue"; -import AdminEvents from "./components/Admin/Events.vue"; -import {useStudentStore} from "./stores/student"; -import {useWorkshopStore} from "./stores/workshops"; -import ExerciseEditor from "./components/Online/ExerciseEditor.vue"; - -const docRoutes = [].concat(...docs.map(doc => { - return doc.sections.map(section => { - const parts = ['docs', doc.path, section.path]; - - return { - path: '/' + parts.filter(part => part !== '').join('/'), - component: section.component, - meta: {section: section, group: doc} - }; - }); -})); +import { useBlogStore } from './stores/blog' +import { useEventStore } from './stores/events' + +import { useAdminStore } from './stores/admin' +import AdminLayout from './components/Admin/AdminLayout.vue' +import EmptyAdminLayout from './components/Admin/EmptyLayout.vue' +import AdminLogin from './components/Admin/PageLogin.vue' +import AminHome from './components/Admin/PageHome.vue' +import AdminWorkshops from './components/Admin/PageWorkshops.vue' +import AdminWorkshop from './components/Admin/PageWorkshop.vue' +import AdminWorkshopInstalls from './components/Admin/PageWorkshopInstalls.vue' +import AdminNewWorkshops from './components/Admin/PageNewWorkshops.vue' +import AdminStudents from './components/Admin/PageStudents.vue' +import AdminSettings from './components/Admin/PageSettings.vue' +import AdminEvents from './components/Admin/PageEvents.vue' +import { useStudentStore } from './stores/student' +import { useWorkshopStore } from './stores/workshops' +import ExerciseEditor from './components/Online/PageExerciseEditor.vue' + +const docRoutes = [].concat( + ...docs.map((doc) => { + return doc.sections.map((section) => { + const parts = ['docs', doc.path, section.path] + + return { + path: '/' + parts.filter((part) => part !== '').join('/'), + component: section.component, + meta: { section: section, group: doc } + } + }) + }) +) const routes = [ - { path: '/', component: Home, meta: {layout: Layout} }, - { path: '/online', component: Dashboard, meta: {layout: CompactLayout} }, - { path: '/online/editor/:workshop/:exercise', component: ExerciseEditor, name: "editor", props:true, meta: {layout: CompactLayout} }, - { path: '/offline', component: Offline, meta: {layout: Layout} }, - { path: '/submit', component: SubmitWorkshop, meta: {layout: Layout} }, - { path: '/docs', component: Docs, children: docRoutes, meta: {layout: Layout} }, - { path: '/events', component: Events, name: "events", meta: {layout: Layout} }, - { path: '/blog', component: BlogIndex, name: "blog", meta: {layout: Layout} }, - { path: '/blog/:page(\\d+)?', component: BlogIndex, props: true, meta: { layout: Layout } }, - { path: '/blog/:slug', component: BlogPost, name: "blog-post", props: true, meta: { layout: Layout } }, - { path: '/login', component: AdminLogin, name: "admin-login", props: true, meta: { layout: EmptyAdminLayout }}, - { path: '/admin', component: AminHome, name: "admin", props: true, meta: { layout: AdminLayout } }, - { path: '/admin/workshops', component: AdminWorkshops, props: true, meta: { layout: AdminLayout }}, - { path: '/admin/workshop/:id', component: AdminWorkshop, props: true, meta: { layout: AdminLayout }}, - { path: '/admin/workshop-installs', component: AdminWorkshopInstalls, props: true, meta: { layout: AdminLayout }}, - { path: '/admin/new-workshops', component: AdminNewWorkshops, props: true, meta: { layout: AdminLayout }}, - { path: '/admin/students', component: AdminStudents, props: true, meta: { layout: AdminLayout }}, - { path: '/admin/settings', component: AdminSettings, props: true, meta: { layout: AdminLayout }}, - { path: '/admin/events', component: AdminEvents, props: true, meta: { layout: AdminLayout }}, -]; + { path: '/', component: Home, meta: { layout: MainLayout } }, + { path: '/online', component: Dashboard, meta: { layout: CompactLayout } }, + { + path: '/online/editor/:workshop/:exercise', + component: ExerciseEditor, + name: 'editor', + props: true, + meta: { layout: CompactLayout } + }, + { path: '/offline', component: Offline, meta: { layout: MainLayout } }, + { path: '/submit', component: SubmitWorkshop, meta: { layout: MainLayout } }, + { + path: '/docs', + component: Docs, + children: docRoutes, + meta: { layout: MainLayout } + }, + { + path: '/events', + component: Events, + name: 'events', + meta: { layout: MainLayout } + }, + { + path: '/blog', + component: BlogIndex, + name: 'blog', + meta: { layout: MainLayout } + }, + { + path: '/blog/:page(\\d+)?', + component: BlogIndex, + props: true, + meta: { layout: MainLayout } + }, + { + path: '/blog/:slug', + component: BlogPost, + name: 'blog-post', + props: true, + meta: { layout: MainLayout } + }, + { + path: '/login', + component: AdminLogin, + name: 'admin-login', + props: true, + meta: { layout: EmptyAdminLayout } + }, + { + path: '/admin', + component: AminHome, + name: 'admin', + props: true, + meta: { layout: AdminLayout } + }, + { + path: '/admin/workshops', + component: AdminWorkshops, + props: true, + meta: { layout: AdminLayout } + }, + { + path: '/admin/workshop/:id', + component: AdminWorkshop, + props: true, + meta: { layout: AdminLayout } + }, + { + path: '/admin/workshop-installs', + component: AdminWorkshopInstalls, + props: true, + meta: { layout: AdminLayout } + }, + { + path: '/admin/new-workshops', + component: AdminNewWorkshops, + props: true, + meta: { layout: AdminLayout } + }, + { + path: '/admin/students', + component: AdminStudents, + props: true, + meta: { layout: AdminLayout } + }, + { + path: '/admin/settings', + component: AdminSettings, + props: true, + meta: { layout: AdminLayout } + }, + { + path: '/admin/events', + component: AdminEvents, + props: true, + meta: { layout: AdminLayout } + } +] export const createApp = ViteSSG( App, { routes, - scrollBehavior(to, from, savedPosition) { + scrollBehavior() { // always scroll to top return { top: 0 } - }, + } }, - async ({ app, router, routes, isClient, initialState, onSSRAppRendered }) => { + async({ app, router, isClient, initialState, onSSRAppRendered }) => { Object.entries(results).forEach(([name, resultComponent]) => { - app.component(name, resultComponent); - }); + app.component(name, resultComponent) + }) app.component('FocusTrap', FocusTrap) - app.component('Terminal', Terminal) - app.use(VueClickAway); - app.use(VueDiff); - app.use(VueShepherdPlugin); + app.use(VueClickAway) + app.use(VueDiff) + app.use(VueShepherdPlugin) const pinia = createPinia() - pinia.use(({ store }) => { store.router = markRaw(router) }); + pinia.use(({ store }) => { + store.router = markRaw(router) + }) app.use(pinia) if (isClient) { - pinia.state.value = (initialState.pinia) || {} + pinia.state.value = initialState.pinia || {} - const studentStore = useStudentStore(pinia); - await studentStore.initialize(); + const studentStore = useStudentStore(pinia) + await studentStore.initialize() } if (!isClient || import.meta.env.DEV) { const blogStore = useBlogStore(pinia) - await blogStore.initialize(); + await blogStore.initialize() const eventStore = useEventStore(pinia) - await eventStore.initialize(); + await eventStore.initialize() const workshopStore = useWorkshopStore(pinia) - await workshopStore.initialize(); + await workshopStore.initialize() onSSRAppRendered(() => { initialState.pinia = pinia.state.value }) } - const adminStore = useAdminStore(pinia); + const adminStore = useAdminStore(pinia) - router.beforeEach(async (to, from) => { + router.beforeEach(async (to) => { //if not admin route and not login route, skip, it's a non-authenticated route if (!to.path.startsWith('/admin') && to.name !== 'admin-login') { - return; + return } //if we are not logged in redirect to login page @@ -138,20 +219,18 @@ export const createApp = ViteSSG( } }) } -); +) export async function includedRoutes(paths, routes) { - let pathsToRender = routes.filter(route => { - return route.name === 'blog' || route.name === 'blog-post' || route.name === 'events'; - }); + let pathsToRender = routes.filter((route) => { + return route.name === 'blog' || route.name === 'blog-post' || route.name === 'events' + }) - const response = await fetch(import.meta.env.VITE_API_URL + '/api/posts'); - const posts = await response.json(); - const slugs = posts.posts.map(post => post.slug); + const response = await fetch(import.meta.env.VITE_API_URL + '/api/posts') + const posts = await response.json() + const slugs = posts.posts.map((post) => post.slug) return pathsToRender.flatMap((route) => { - return route.name === 'blog-post' - ? slugs.map(slug => `/blog/${slug}`) - : route.path - }); -} \ No newline at end of file + return route.name === 'blog-post' ? slugs.map((slug) => `/blog/${slug}`) : route.path + }) +} diff --git a/assets/components/Admin/AdminLayout.vue b/assets/components/Admin/AdminLayout.vue new file mode 100644 index 00000000..120704a5 --- /dev/null +++ b/assets/components/Admin/AdminLayout.vue @@ -0,0 +1,351 @@ + + + + + diff --git a/assets/components/Admin/EmptyLayout.vue b/assets/components/Admin/EmptyLayout.vue index ee530b9e..052f4778 100644 --- a/assets/components/Admin/EmptyLayout.vue +++ b/assets/components/Admin/EmptyLayout.vue @@ -3,4 +3,3 @@ - diff --git a/assets/components/Admin/Events.vue b/assets/components/Admin/Events.vue deleted file mode 100644 index 9dc9f806..00000000 --- a/assets/components/Admin/Events.vue +++ /dev/null @@ -1,421 +0,0 @@ - -