diff --git a/apps/classroomio-com/package.json b/apps/classroomio-com/package.json index fa5bb6e8..1584acbb 100644 --- a/apps/classroomio-com/package.json +++ b/apps/classroomio-com/package.json @@ -17,7 +17,7 @@ "carbon-icons-svelte": "^12.3.0", "mdsvex": "^0.11.0", "postcss": "^8.4.29", - "svelte": "^4.0.5", + "svelte": "^4.1.2", "svelte-check": "^3.4.3", "svelte-sequential-preprocessor": "^2.0.1", "tailwindcss": "^3.3.3", @@ -26,6 +26,7 @@ }, "type": "module", "dependencies": { + "html-to-image": "^1.11.11", "just-extend": "^6.2.0", "posthog-node": "^3.1.3", "rehype-slug": "^6.0.0", diff --git a/apps/classroomio-com/src/app.css b/apps/classroomio-com/src/app.css index 4c2a94f9..faa3b2f1 100644 --- a/apps/classroomio-com/src/app.css +++ b/apps/classroomio-com/src/app.css @@ -106,6 +106,14 @@ li { background-image: url('/hero-bg.svg'); } +.tools-hero-bg { + background-image: url('/tools-hero-bg.svg'); +} +@media (min-width: 760px) { + .tools-hero-bg { + min-height: 350px; + } +} .cio-bg-blue { background: rgb(2, 51, 189); background-size: cover; diff --git a/apps/classroomio-com/src/app.html b/apps/classroomio-com/src/app.html index 8d0e8292..fe869548 100644 --- a/apps/classroomio-com/src/app.html +++ b/apps/classroomio-com/src/app.html @@ -24,8 +24,7 @@ - + diff --git a/apps/classroomio-com/src/lib/Footer/Footer.svelte b/apps/classroomio-com/src/lib/Footer/Footer.svelte index 9618e552..5752e0d6 100644 --- a/apps/classroomio-com/src/lib/Footer/Footer.svelte +++ b/apps/classroomio-com/src/lib/Footer/Footer.svelte @@ -17,7 +17,7 @@

Launch Your Online Bootcamp In Minutes
- The easiest way to launch and scale your online bootcamp + ClassroomIO is the easiest way to grow your teaching business.

+
+
+
+

+ Play With Our Free Tools +

+

+ Innovative tools to help you aid you example preparation, as well as making learning + more fun for students and educator looking for engaging resources. +

+
+ + {#each freeTools as tool} + + +
+

{tool.title}

+

+ {tool.subText} +

+
+
+ {/each} +
+
+ + More Tools + +
+
diff --git a/apps/classroomio-com/src/lib/StudentDashboard/StudentDashboard.svelte b/apps/classroomio-com/src/lib/Home/StudentDashboard.svelte similarity index 100% rename from apps/classroomio-com/src/lib/StudentDashboard/StudentDashboard.svelte rename to apps/classroomio-com/src/lib/Home/StudentDashboard.svelte diff --git a/apps/classroomio-com/src/lib/Testimonial/Testimonial.svelte b/apps/classroomio-com/src/lib/Home/Testimonial.svelte similarity index 100% rename from apps/classroomio-com/src/lib/Testimonial/Testimonial.svelte rename to apps/classroomio-com/src/lib/Home/Testimonial.svelte diff --git a/apps/classroomio-com/src/lib/Faq/faqs.js b/apps/classroomio-com/src/lib/Home/faqs.js similarity index 100% rename from apps/classroomio-com/src/lib/Faq/faqs.js rename to apps/classroomio-com/src/lib/Home/faqs.js diff --git a/apps/classroomio-com/src/lib/Modal/Modal.svelte b/apps/classroomio-com/src/lib/Modal/Modal.svelte new file mode 100644 index 00000000..010e751d --- /dev/null +++ b/apps/classroomio-com/src/lib/Modal/Modal.svelte @@ -0,0 +1,16 @@ + + +{#if open} +
+ +
+
+ +
+
+{/if} diff --git a/apps/classroomio-com/src/lib/Navigation/Navigation.svelte b/apps/classroomio-com/src/lib/Navigation/Navigation.svelte index accdd37e..2839f575 100644 --- a/apps/classroomio-com/src/lib/Navigation/Navigation.svelte +++ b/apps/classroomio-com/src/lib/Navigation/Navigation.svelte @@ -52,7 +52,7 @@
- +
-
{/if} + { - handleShowNav(); - }} - href="/pricing" - class:active={activeLink.startsWith('/pricing')} + on:click={handleShowNav} + href="/tools" > -
  • Pricing
  • +
  • Free Tools
  • - { handleShowNav(); @@ -234,7 +239,7 @@ target="_blank" >
  • Docs
  • -
    + --> { @@ -245,6 +250,17 @@ >
  • Blog
  • + + { + handleShowNav(); + }} + href="/pricing" + class:active={activeLink.startsWith('/pricing')} + > +
  • Pricing
  • +
    { diff --git a/apps/classroomio-com/src/lib/ToolsHeader/ToolsHeader.svelte b/apps/classroomio-com/src/lib/ToolsHeader/ToolsHeader.svelte new file mode 100644 index 00000000..a45ffb80 --- /dev/null +++ b/apps/classroomio-com/src/lib/ToolsHeader/ToolsHeader.svelte @@ -0,0 +1,7 @@ + + +
    + +
    diff --git a/apps/classroomio-com/src/lib/utils/constants/tools.ts b/apps/classroomio-com/src/lib/utils/constants/tools.ts new file mode 100644 index 00000000..07250ab5 --- /dev/null +++ b/apps/classroomio-com/src/lib/utils/constants/tools.ts @@ -0,0 +1,71 @@ +interface Tool { + src: string; + title: string; + subText: string; + slug: string; + show: boolean; + showFeature: boolean; +} + +export const tools: Tool[] = [ + { + src: '/free-tools/progress-report.svg', + title: 'Progress Report', + subText: 'Monitor your progress with a system to check and share your progress with others', + slug: 'progress', + show: true, + showFeature: true + }, + { + src: '/free-tools/pomodoro.svg', + title: 'Pomodoro Timer', + subText: + 'Make your workday more engaging and effective with the Pomodoro timer, break work into 25-minute focused intervals called "pomodoros".', + slug: 'pomodoro', + show: true, + showFeature: false + }, + { + src: '/free-tools/name-picker.svg', + title: 'Random Name Picker', + subText: 'Effortlessly choose names for class participation or group activities', + slug: 'name-picker', + show: true, + showFeature: false + }, + { + src: '/free-tools/activity-stopwatch.svg', + title: 'Activity Stopwatch', + subText: + 'Stay on track and enhance productivity with our customizable stopwatch for timed tasks, quizzes, and study sessions', + slug: 'stopwatch', + show: true, + showFeature: true + }, + { + src: '/free-tools/tic-tac.svg', + title: 'Tic tac toe game', + subText: + "More than just a game; it's an educational tool that teaches pattern recognition, and decision-making.", + slug: 'tic-tac-toe', + show: true, + showFeature: true + }, + { + src: '/free-tools/waec.svg', + title: 'WAEC Practice tool', + subText: 'Ace your WAEC exams with comprehensive study materials, past questions', + slug: 'waec', + show: false, + showFeature: false + }, + { + src: '/free-tools/jamb.svg', + title: 'JAMB Practice tool', + subText: + 'Prepare for JAMB with past questions and instant feedback for effective exam readiness', + slug: 'jamb', + show: false, + showFeature: false + } +]; diff --git a/apps/classroomio-com/src/routes/+layout.svelte b/apps/classroomio-com/src/routes/+layout.svelte index c72af3c1..0cbfa93e 100644 --- a/apps/classroomio-com/src/routes/+layout.svelte +++ b/apps/classroomio-com/src/routes/+layout.svelte @@ -16,7 +16,7 @@ -
    +
    diff --git a/apps/classroomio-com/src/routes/+page.svelte b/apps/classroomio-com/src/routes/+page.svelte index 100abe3c..69245c22 100644 --- a/apps/classroomio-com/src/routes/+page.svelte +++ b/apps/classroomio-com/src/routes/+page.svelte @@ -1,10 +1,10 @@ - + diff --git a/apps/classroomio-com/src/routes/pricing/+page.svelte b/apps/classroomio-com/src/routes/pricing/+page.svelte index 5fc3b36d..5d2d0a20 100644 --- a/apps/classroomio-com/src/routes/pricing/+page.svelte +++ b/apps/classroomio-com/src/routes/pricing/+page.svelte @@ -186,9 +186,9 @@ diff --git a/apps/classroomio-com/src/routes/teach/+page.svelte b/apps/classroomio-com/src/routes/teach/+page.svelte index 43da5cf8..537e9a79 100644 --- a/apps/classroomio-com/src/routes/teach/+page.svelte +++ b/apps/classroomio-com/src/routes/teach/+page.svelte @@ -77,11 +77,7 @@ Teach | ClassroomIO - + @@ -99,7 +95,7 @@ name="twitter:description" content="On ClassroomIO you can make side income while doing what you love." /> - +
    @@ -113,7 +109,7 @@ Register @@ -169,7 +165,7 @@ Get Started diff --git a/apps/classroomio-com/src/routes/tools/+layout.svelte b/apps/classroomio-com/src/routes/tools/+layout.svelte new file mode 100644 index 00000000..17f18e45 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/+layout.svelte @@ -0,0 +1,40 @@ + + + + Free Tools | ClassroomIO + + + + + + + + + + + + + + diff --git a/apps/classroomio-com/src/routes/tools/+layout.ts b/apps/classroomio-com/src/routes/tools/+layout.ts new file mode 100644 index 00000000..189f71e2 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/+layout.ts @@ -0,0 +1 @@ +export const prerender = true; diff --git a/apps/classroomio-com/src/routes/tools/+page.svelte b/apps/classroomio-com/src/routes/tools/+page.svelte new file mode 100644 index 00000000..0f34bc96 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/+page.svelte @@ -0,0 +1,80 @@ + + +
    + + +
    +

    + Explore our free tools +

    +

    + Innovative tools to help you aid you example preparation, as well as making learning more + fun for students and educator looking for engaging resources. +

    + +
    + + Progress Report + Activity Stopwatch logo + Name picker logo + Tic tac logo + Pomodoro Timer logo + +
    +
    +
    + +
    +

    Featured Tools

    + +
    + {#each freeTools as tool} + + +
    +

    {tool.title}

    +

    + {tool.subText} +

    +
    +
    + {/each} +
    +
    +
    diff --git a/apps/classroomio-com/src/routes/tools/name-picker/+page.svelte b/apps/classroomio-com/src/routes/tools/name-picker/+page.svelte new file mode 100644 index 00000000..913251ff --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/name-picker/+page.svelte @@ -0,0 +1,260 @@ + + + + Random Name Picker | ClassroomIO + + + + + + + + + + + +
    + + +

    Random Name Picker

    +

    + Use this online name picker to draw a random name from a list of names, or to draw several + names randomly out of a list. You can use it as a name randomizer for a class activities. +

    +
    + +
    +
    +

    List of names

    + + +
    + +
    + + +
    + + +
    + +
    + + +

    + name count: {wordCount} +

    +
    +

    Each name must be separated by a comma

    + +
    +

    Number of Names

    + +
    + + +
    +
    + + +
    + + {#if selectedNames.length > 0} +

    Selected Names

    + {/if} +
    + + + {#if selectedNames.length > 0 && !avatarUrlsFetched} +
    +

    Loading...

    +
    + {/if} + + + {#if selectedNames.length > 0 && avatarUrlsFetched} +
    +
      + {#each selectedNames as name, index} +
    • +
      + +

      + {name} +

      +
      +
    • + {/each} +
    + +
    + + +
    +
    + {/if} +
    +
    +
    diff --git a/apps/classroomio-com/src/routes/tools/pomodoro/+page.svelte b/apps/classroomio-com/src/routes/tools/pomodoro/+page.svelte new file mode 100644 index 00000000..9a1b04f8 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/pomodoro/+page.svelte @@ -0,0 +1,393 @@ + + + + Pomodoro Timer | ClassroomIO + + + + + + + + + + + +
    + + +

    Pomodoro Timer

    +

    + Make your workday more engaging and effective with the Pomodoro timer, break work into + 25-minute focused intervals called "pomodoros," followed by 5-minute breaks. take a longer + break. +

    +
    + +
    + +
    + +
    + + + +
    + + +

    {countdownDisplay}

    + + +
    + + + + + + + + +
    +
    + + +
    +

    + To do list +

    + +
    + +
    + {#each todoList as todo, i} +
    + {#if todo.isEditing} +
    setEditing(i, false)}> +

    Pomodoro name

    + +
    + + +
    +
    + {:else} +
    +
    +

    {todo.content}

    + + +
    + + + + + {#if todo.isVisible} +
      + + +
    + {/if} +
    +
    + +
    +

    + {todo.time} +

    + + +
    +
    + {/if} +
    + {/each} +
    + + + +
    +
    +
    +
    + + diff --git a/apps/classroomio-com/src/routes/tools/progress/+page.svelte b/apps/classroomio-com/src/routes/tools/progress/+page.svelte new file mode 100644 index 00000000..f3f40965 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/progress/+page.svelte @@ -0,0 +1,426 @@ + + + + Random Name Picker | ClassroomIO + + + + + + + + + + + +
    + + +

    Progress Report

    +

    + Generate cool reports of your learning progress. Share reports with your network for + collaborative learning +

    +
    + + + + + + + +
    + + {#if showSetter} +
    + +
    + +
    + + +
    +

    Add your name

    + handleInputChange(event, 'name')} + placeholder="Enter your name here" + class="w-full border my-3 py-2 px-3 outline-none rounded-sm bg-[#F1F2F4] text-xs placeholder:text-sm placeholder:text-[#ADADAD]" + /> +
    + + +
    +

    Select your mood

    + +
    + + +
    +

    What are you learning?

    + +

    {remainingChars} characters remaining

    +
    + + +
    +

    Estimate your progress

    +
    + handleInputChange(event, 'progress')} + style="background: linear-gradient(to right, #0F62FE {$htmlBody.progress}%, #ccc {$htmlBody.progress}%);" + /> +

    {$htmlBody.progress}%

    +
    +
    + + +
    +
    +

    Choose your avatar

    + +
    + + +
    +

    Choose your background

    + +
    +
    + +
    + {/if} + + + +
    + + + {#if showReport} + +
    + +
    + + + +
    + + + +
    +

    Share on image on social media:

    + +
    + + + +
    +
    +
    + {/if} +
    +
    +
    + + diff --git a/apps/classroomio-com/src/routes/tools/progress/components/Avatar.svelte b/apps/classroomio-com/src/routes/tools/progress/components/Avatar.svelte new file mode 100644 index 00000000..53028489 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/progress/components/Avatar.svelte @@ -0,0 +1,88 @@ + + + + +
    +

    Choose your Avatars

    + +
    + + +
    + {#each avatars as avatar, index} + + {/each} +
    + +
    diff --git a/apps/classroomio-com/src/routes/tools/progress/components/Background.svelte b/apps/classroomio-com/src/routes/tools/progress/components/Background.svelte new file mode 100644 index 00000000..2e68365c --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/progress/components/Background.svelte @@ -0,0 +1,87 @@ + + + + +
    +

    Choose your Background

    + +
    + + +
    + {#each backgrounds as background} + + {/each} +
    + +
    diff --git a/apps/classroomio-com/src/routes/tools/progress/components/DownloadButton.svelte b/apps/classroomio-com/src/routes/tools/progress/components/DownloadButton.svelte new file mode 100644 index 00000000..0693448a --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/progress/components/DownloadButton.svelte @@ -0,0 +1,52 @@ + + + diff --git a/apps/classroomio-com/src/routes/tools/progress/components/FullView.svelte b/apps/classroomio-com/src/routes/tools/progress/components/FullView.svelte new file mode 100644 index 00000000..ca5555b7 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/progress/components/FullView.svelte @@ -0,0 +1,11 @@ + + + + + + + diff --git a/apps/classroomio-com/src/routes/tools/progress/components/Mood.svelte b/apps/classroomio-com/src/routes/tools/progress/components/Mood.svelte new file mode 100644 index 00000000..391cc241 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/progress/components/Mood.svelte @@ -0,0 +1,100 @@ + + + + +
    +

    Choose your Mood

    + +
    + + +
    + {#each moods as mood} + + {/each} +
    + +
    diff --git a/apps/classroomio-com/src/routes/tools/progress/components/Report.svelte b/apps/classroomio-com/src/routes/tools/progress/components/Report.svelte new file mode 100644 index 00000000..7330a4df --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/progress/components/Report.svelte @@ -0,0 +1,142 @@ + + +
    + + {#if $openModal.showFullscreenButton} + {#if $openModal.fullscreen} + + {:else} + + {/if} + {/if} + +
    + +
    +
    + + + + + {#if $htmlBody.name || $htmlBody.mood.text} +
    + {$htmlBody.name} + + {#if $htmlBody.mood.text} + +

    + is {$htmlBody.mood.text} +

    + {$htmlBody.mood.text} +
    + {/if} +
    + {:else} +

    + Add your name +

    + {/if} + + + + {$htmlBody.learning} + + + +
    +
    +
    +
    +

    Progress Achieved: {$htmlBody.progress}%

    +
    +
    +
    + +
    + classroomio logo +

    ClassroomIO.com

    +
    + +
    +
    + + + diff --git a/apps/classroomio-com/src/routes/tools/progress/components/store.ts b/apps/classroomio-com/src/routes/tools/progress/components/store.ts new file mode 100644 index 00000000..a2fba3a4 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/progress/components/store.ts @@ -0,0 +1,59 @@ +import { derived, writable } from 'svelte/store'; +import type { Writable } from 'svelte/store'; + +interface OpenModal { + avatar: boolean; + background: boolean; + fullscreen: boolean; + showFullscreenButton: boolean; + mood: boolean; +} + +export interface HtmlBody { + name: string; + learning: string; + progress: number; + avatar: string; + background: string; + mood: { + text: string; + iconSrc: string; + }; +} + +// store for the node binded to the report component for the component to image conversion +export const nodeStore = writable(null); + +export const openModal: Writable = writable({ + avatar: false, + background: false, + fullscreen: false, + showFullscreenButton: true, + mood: false +}); + +const placeholderLearning = 'Tell us what you are learning'; + +// report html +export const htmlBody: Writable = writable({ + name: '', + learning: placeholderLearning, + progress: 10, + avatar: '', + background: '', + mood: { + text: '', + iconSrc: '' + } +}); + +// a mini validation for the htmlBody store that ensures all fields are filled +export const isFormComplete = derived(htmlBody, ($htmlBody) => { + return !!( + $htmlBody.name.trim() && + $htmlBody.learning.trim() !== placeholderLearning && + $htmlBody.progress > 0 && + $htmlBody.mood.text.trim() && + $htmlBody.mood.iconSrc.trim() + ); +}); diff --git a/apps/classroomio-com/src/routes/tools/stopwatch/+page.svelte b/apps/classroomio-com/src/routes/tools/stopwatch/+page.svelte new file mode 100644 index 00000000..40b7f060 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/stopwatch/+page.svelte @@ -0,0 +1,240 @@ + + + + Activity Stopwatch | ClassroomIO + + + + + + + + + + + +
    + + +

    Activity Stopwatch

    +

    + Stay on track and enhance productivity with our customizable stopwatch for timed tasks, + quizzes, and study sessions. +

    +
    + +
    + + {#if !isNextStep} +
    +
    +
    +

    Name of activity

    + +
    + +
    +

    Set an Activity

    +
    +
    +
    + +

    hrs

    +
    +
    + +
    +
    + +

    mins

    +
    +
    + +
    +
    + +

    sec

    +
    +
    +
    + +
    + +
    +
    +
    +
    + {/if} + + + {#if isNextStep} + + {/if} +
    +
    diff --git a/apps/classroomio-com/src/routes/tools/stopwatch/components/Timer.svelte b/apps/classroomio-com/src/routes/tools/stopwatch/components/Timer.svelte new file mode 100644 index 00000000..2687d04e --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/stopwatch/components/Timer.svelte @@ -0,0 +1,70 @@ + + +
    +
    + + + + + +

    {displayTime}

    +
    + +
    + + + +
    +
    diff --git a/apps/classroomio-com/src/routes/tools/tic-tac-toe/+page.svelte b/apps/classroomio-com/src/routes/tools/tic-tac-toe/+page.svelte new file mode 100644 index 00000000..5100e7a9 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/tic-tac-toe/+page.svelte @@ -0,0 +1,236 @@ + + + + Tic Tac Toe | ClassroomIO + + + + + + + + + + + +
    + + Tic Tac Icon +

    Tic-Tac game

    +

    + More than just a game; it's an educational tool that teaches pattern recognition, and + decision-making. +

    +
    + +
    + + {#if message} +
    +
    + {#if message != 'Tie game!'} + Star icon + {/if} +

    {message}

    +
    + + +
    + {/if} + + + {#if startGame} +
    +
    + + +
    + + + + + +
    +
    + Player 1 + {$scores.X} +
    +
    + Draw + {$scores.draw} +
    +
    + Player 2 + {$scores.O} +
    +
    +
    + + + {:else} +
    + Tic tac toe game icon +
    + + +
    +
    + {/if} +
    +
    + + diff --git a/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/Board.svelte b/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/Board.svelte new file mode 100644 index 00000000..9fd15f07 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/Board.svelte @@ -0,0 +1,99 @@ + + +
    + + + {#each game.board as row, rowIndex} + + {#each row as column, columnIndex} + + {/each} + + {/each} + +
    { + game = game.click(rowIndex, columnIndex); + }} + > + {#if column === 'X'} + X icon + {:else if column === 'O'} + O icon + {:else} + + {/if} +
    + + +
    + + diff --git a/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/WinningLine.svelte b/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/WinningLine.svelte new file mode 100644 index 00000000..c7ae864c --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/WinningLine.svelte @@ -0,0 +1,80 @@ + + +{#if winner} +
    +{/if} + + diff --git a/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/board.ts b/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/board.ts new file mode 100644 index 00000000..31158e2d --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/board.ts @@ -0,0 +1,178 @@ +import { scores, changeToComputer } from './store'; + +let activateComp = false; + +changeToComputer.subscribe((value) => { + if (value && value.change === true) { + activateComp = true; + } else { + activateComp = false; + } +}); + +export function TicTacToe({ onWin, onTie }: { onWin: (winner: any) => void, onTie: () => void }) { + const board = [ + ['', '', ''], + ['', '', ''], + ['', '', ''] + ]; + + let turn = 'X'; + let done = false; + + return { + board, + + click(rowIndex:number, columnIndex:number) { + if (!done && !board[rowIndex][columnIndex]) { + board[rowIndex][columnIndex] = turn; + turn = turn === 'X' ? 'O' : 'X'; + + const winner = getWinner(board); + + if (winner) { + onWin(winner); + done = true; + } else if (isBoardFull(board)) { + onTie(); + scores.update((currentScores) => { + return { ...currentScores, draw: currentScores.draw + 1 }; + }); + done = true; + } else { + if (activateComp) { + const aiMove = getBestMove(board); + if (aiMove) { + board[aiMove.row][aiMove.column] = 'O'; + turn = 'X'; + + const aiWinner = getWinner(board); + if (aiWinner) { + onWin(aiWinner); + done = true; + } else if (isBoardFull(board)) { + onTie(); + scores.update((currentScores) => { + return { ...currentScores, draw: currentScores.draw + 1 }; + }); + done = true; + } + } else { + console.error("AI could not find a valid move."); + } + } + + } + } + + return this; + } + }; +} + +function getWinner(board: string[][]) { + // check rows + for (let row = 0; row < 3; row++) { + if (board[row][0] === board[row][1] && board[row][0] === board[row][2] && board[row][0]) { + return { symbol: board[row][0], direction: 'horizontal', row }; + } + } + + // check columns + for (let column = 0; column < 3; column++) { + if ( + board[0][column] === board[1][column] && + board[0][column] === board[2][column] && + board[0][column] + ) { + return { symbol: board[0][column], direction: 'vertical', column }; + } + } + + // check diagonals + if (board[0][0] === board[1][1] && board[0][0] == board[2][2] && board[0][0]) { + return { symbol: board[0][0], direction: 'diagonal', diagonal: 'top-left-to-bottom-right' }; + } + + if (board[0][2] === board[1][1] && board[0][2] == board[2][0] && board[0][2]) { + return { symbol: board[0][2], direction: 'diagonal', diagonal: 'top-right-to-bottom-left' }; + } + + // no winner + return null; +} + +function isBoardFull(board: string[][]) { + for (let row = 0; row < 3; row++) { + for (let column = 0; column < 3; column++) { + if (!board[row][column]) { + return false; + } + } + } + + return true; +} + +function getBestMove(board: string[][]) { + let bestScore = -Infinity; + let move; + + for (let i = 0; i < 3; i++) { + for (let j = 0; j < 3; j++) { + // check if cell is empty + if (board[i][j] === '') { + board[i][j] = 'O'; // make the move + let score = minimax(board, 0, false); // call minimax on the new board + board[i][j] = ''; // undo the move + if (score > bestScore) { + bestScore = score; + move = { row: i, column: j }; + } + } + } + } + + return move; +} + +function minimax(board: string[][], depth: number, isMaximizing: boolean) { + const result = getWinner(board); + if (result !== null) { + if (result.symbol === 'O') { + return 10 - depth; // ai wins + } else if (result.symbol === 'X') { + return depth - 10; // player wins + } else { + return 0; // draw + } + } + + if (isMaximizing) { + let bestScore = -Infinity; + for (let i = 0; i < 3; i++) { + for (let j = 0; j < 3; j++) { + if (board[i][j] === '') { + board[i][j] = 'O'; + let score = minimax(board, depth + 1, false); + board[i][j] = ''; + bestScore = Math.max(score, bestScore); + } + } + } + return bestScore; + } else { + let bestScore = Infinity; + for (let i = 0; i < 3; i++) { + for (let j = 0; j < 3; j++) { + if (board[i][j] === '') { + board[i][j] = 'X'; + let score = minimax(board, depth + 1, true); + board[i][j] = ''; + bestScore = Math.min(score, bestScore); + } + } + } + return bestScore; + } +} diff --git a/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/store.ts b/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/store.ts new file mode 100644 index 00000000..ee8dfc80 --- /dev/null +++ b/apps/classroomio-com/src/routes/tools/tic-tac-toe/components/store.ts @@ -0,0 +1,22 @@ +import { writable } from 'svelte/store'; +import type {Writable} from 'svelte/store' + +interface Scores { + X: number; + O: number; + draw: number; +} + +interface ChangeToComputer { + change: boolean; +} + +export const scores: Writable = writable({ + X: 0, + O: 0, + draw: 0 +}); + +export const changeToComputer: Writable = writable({ + change: false +}); diff --git a/apps/classroomio-com/static/free-tools/activity-stopwatch.svg b/apps/classroomio-com/static/free-tools/activity-stopwatch.svg new file mode 100644 index 00000000..9b818663 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/activity-stopwatch.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/jamb.svg b/apps/classroomio-com/static/free-tools/jamb.svg new file mode 100644 index 00000000..c35cc4e7 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/jamb.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/name-picker.svg b/apps/classroomio-com/static/free-tools/name-picker.svg new file mode 100644 index 00000000..43cdc8c5 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/name-picker.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/pomodoro.svg b/apps/classroomio-com/static/free-tools/pomodoro.svg new file mode 100644 index 00000000..71b8d4a7 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/pomodoro.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/pomodoro/add-icon.svg b/apps/classroomio-com/static/free-tools/pomodoro/add-icon.svg new file mode 100644 index 00000000..7489cf23 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/pomodoro/add-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/pomodoro/done-icon.svg b/apps/classroomio-com/static/free-tools/pomodoro/done-icon.svg new file mode 100644 index 00000000..24de8089 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/pomodoro/done-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/pomodoro/list-play-icon.svg b/apps/classroomio-com/static/free-tools/pomodoro/list-play-icon.svg new file mode 100644 index 00000000..765d99a2 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/pomodoro/list-play-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/pomodoro/menu-icon.svg b/apps/classroomio-com/static/free-tools/pomodoro/menu-icon.svg new file mode 100644 index 00000000..7a09ab13 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/pomodoro/menu-icon.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/pomodoro/pause-icon.svg b/apps/classroomio-com/static/free-tools/pomodoro/pause-icon.svg new file mode 100644 index 00000000..33bb87d0 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/pomodoro/pause-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/pomodoro/pen-icon.svg b/apps/classroomio-com/static/free-tools/pomodoro/pen-icon.svg new file mode 100644 index 00000000..df0659f4 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/pomodoro/pen-icon.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/pomodoro/restart-icon.svg b/apps/classroomio-com/static/free-tools/pomodoro/restart-icon.svg new file mode 100644 index 00000000..bad57703 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/pomodoro/restart-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/pomodoro/settings-icon.svg b/apps/classroomio-com/static/free-tools/pomodoro/settings-icon.svg new file mode 100644 index 00000000..d4b9759c --- /dev/null +++ b/apps/classroomio-com/static/free-tools/pomodoro/settings-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/pomodoro/timer-play-icon.svg b/apps/classroomio-com/static/free-tools/pomodoro/timer-play-icon.svg new file mode 100644 index 00000000..bb09a230 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/pomodoro/timer-play-icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/classroomio-com/static/free-tools/progress-report.svg b/apps/classroomio-com/static/free-tools/progress-report.svg new file mode 100644 index 00000000..e118c530 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/progress-report.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/progress-report/close-icon.svg b/apps/classroomio-com/static/free-tools/progress-report/close-icon.svg new file mode 100644 index 00000000..f012c273 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/progress-report/close-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/progress-report/full-screen-icon.svg b/apps/classroomio-com/static/free-tools/progress-report/full-screen-icon.svg new file mode 100644 index 00000000..9d2bf8f1 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/progress-report/full-screen-icon.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/progress-report/hide-icon.svg b/apps/classroomio-com/static/free-tools/progress-report/hide-icon.svg new file mode 100644 index 00000000..c00d0019 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/progress-report/hide-icon.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/progress-report/hover-plus-icon.svg b/apps/classroomio-com/static/free-tools/progress-report/hover-plus-icon.svg new file mode 100644 index 00000000..7ad3d238 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/progress-report/hover-plus-icon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/progress-report/preview-icon.svg b/apps/classroomio-com/static/free-tools/progress-report/preview-icon.svg new file mode 100644 index 00000000..d6aed764 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/progress-report/preview-icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/classroomio-com/static/free-tools/progress-report/question-mark.svg b/apps/classroomio-com/static/free-tools/progress-report/question-mark.svg new file mode 100644 index 00000000..29aa3cc3 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/progress-report/question-mark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/apps/classroomio-com/static/free-tools/progress-report/smiley-face-icon.svg b/apps/classroomio-com/static/free-tools/progress-report/smiley-face-icon.svg new file mode 100644 index 00000000..ee5320df --- /dev/null +++ b/apps/classroomio-com/static/free-tools/progress-report/smiley-face-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/stopwatch/loading-timer.svg b/apps/classroomio-com/static/free-tools/stopwatch/loading-timer.svg new file mode 100644 index 00000000..c96a5f80 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/stopwatch/loading-timer.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/apps/classroomio-com/static/free-tools/stopwatch/no-speaker-icon.svg b/apps/classroomio-com/static/free-tools/stopwatch/no-speaker-icon.svg new file mode 100644 index 00000000..fc68ae74 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/stopwatch/no-speaker-icon.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/stopwatch/pause-icon.svg b/apps/classroomio-com/static/free-tools/stopwatch/pause-icon.svg new file mode 100644 index 00000000..dc472fef --- /dev/null +++ b/apps/classroomio-com/static/free-tools/stopwatch/pause-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/stopwatch/play-icon.svg b/apps/classroomio-com/static/free-tools/stopwatch/play-icon.svg new file mode 100644 index 00000000..42a412c6 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/stopwatch/play-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/stopwatch/reset-icon.svg b/apps/classroomio-com/static/free-tools/stopwatch/reset-icon.svg new file mode 100644 index 00000000..30cc003e --- /dev/null +++ b/apps/classroomio-com/static/free-tools/stopwatch/reset-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/stopwatch/speaker-icon.svg b/apps/classroomio-com/static/free-tools/stopwatch/speaker-icon.svg new file mode 100644 index 00000000..e9e70c1e --- /dev/null +++ b/apps/classroomio-com/static/free-tools/stopwatch/speaker-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/tic-tac.svg b/apps/classroomio-com/static/free-tools/tic-tac.svg new file mode 100644 index 00000000..c1b7f004 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/tic-tac.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/tic-tac/computer-icon.svg b/apps/classroomio-com/static/free-tools/tic-tac/computer-icon.svg new file mode 100644 index 00000000..8702ba5c --- /dev/null +++ b/apps/classroomio-com/static/free-tools/tic-tac/computer-icon.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/tic-tac/restart-icon.svg b/apps/classroomio-com/static/free-tools/tic-tac/restart-icon.svg new file mode 100644 index 00000000..63e2a968 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/tic-tac/restart-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-bg.svg b/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-bg.svg new file mode 100644 index 00000000..52a03bd0 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-bg.svg @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-o.svg b/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-o.svg new file mode 100644 index 00000000..69374a75 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-o.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-start-icon.svg b/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-start-icon.svg new file mode 100644 index 00000000..a2360c51 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-start-icon.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-x.svg b/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-x.svg new file mode 100644 index 00000000..c755808a --- /dev/null +++ b/apps/classroomio-com/static/free-tools/tic-tac/tic-tac-x.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/classroomio-com/static/free-tools/tic-tac/winner-star-icon.svg b/apps/classroomio-com/static/free-tools/tic-tac/winner-star-icon.svg new file mode 100644 index 00000000..d9130f95 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/tic-tac/winner-star-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/classroomio-com/static/free-tools/waec.svg b/apps/classroomio-com/static/free-tools/waec.svg new file mode 100644 index 00000000..eedeeb15 --- /dev/null +++ b/apps/classroomio-com/static/free-tools/waec.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/apps/classroomio-com/static/socials-avatar.png b/apps/classroomio-com/static/socials-avatar.png new file mode 100644 index 00000000..b6d2ff2e Binary files /dev/null and b/apps/classroomio-com/static/socials-avatar.png differ diff --git a/apps/classroomio-com/static/sort-icon.svg b/apps/classroomio-com/static/sort-icon.svg new file mode 100644 index 00000000..a305fdad --- /dev/null +++ b/apps/classroomio-com/static/sort-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/classroomio-com/static/tools-hero-bg.svg b/apps/classroomio-com/static/tools-hero-bg.svg new file mode 100644 index 00000000..6d9cd38e --- /dev/null +++ b/apps/classroomio-com/static/tools-hero-bg.svg @@ -0,0 +1,28 @@ + + + + + + + + + + \ No newline at end of file diff --git a/apps/classroomio-com/static/unsort-icon.svg b/apps/classroomio-com/static/unsort-icon.svg new file mode 100644 index 00000000..308b0949 --- /dev/null +++ b/apps/classroomio-com/static/unsort-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/dashboard/README.md b/apps/dashboard/README.md index 375aaab2..8dbf9fe4 100644 --- a/apps/dashboard/README.md +++ b/apps/dashboard/README.md @@ -12,7 +12,7 @@ ## ✨ About ClassroomIO -ClassroomIO Courses page +ClassroomIO Courses page Streamline training for everyone with ClassroomIO.com. Our all-in-one platform empowers bootcamps, educators, and businesses to manage training programs easily. With our platform, anyone can run multiple classes and cohorts all from one UI. The application is mobile-first, which means that students can access your lesson materials from any device. diff --git a/apps/dashboard/src/lib/components/Buttons/Logout/index.svelte b/apps/dashboard/src/lib/components/Buttons/Logout/index.svelte deleted file mode 100644 index 597aa905..00000000 --- a/apps/dashboard/src/lib/components/Buttons/Logout/index.svelte +++ /dev/null @@ -1,30 +0,0 @@ - - - diff --git a/apps/dashboard/src/lib/components/LMS/SideBar.svelte b/apps/dashboard/src/lib/components/LMS/SideBar.svelte index b7255b8c..9b67fd37 100644 --- a/apps/dashboard/src/lib/components/LMS/SideBar.svelte +++ b/apps/dashboard/src/lib/components/LMS/SideBar.svelte @@ -3,16 +3,17 @@ import HelpIcon from 'carbon-icons-svelte/lib/Help.svelte'; import LicenseDraft from 'carbon-icons-svelte/lib/LicenseDraft.svelte'; import Explore from 'carbon-icons-svelte/lib/Explore.svelte'; - import Settings from 'carbon-icons-svelte/lib/Settings.svelte'; import HomeIcon from '$lib/components/Icons/HomeIcon.svelte'; import CourseIcon from '$lib/components/Icons/CourseIcon.svelte'; import CommunityIcon from '$lib/components/Icons/CommunityIcon.svelte'; import Avatar from '$lib/components/Avatar/index.svelte'; import { profile } from '$lib/utils/store/user'; import { NavClasses } from '$lib/utils/constants/reusableClass'; - import { sideBar } from '$lib/components/Org/store'; + import { profileMenu, sideBar } from '$lib/components/Org/store'; import { t } from '$lib/utils/functions/translations'; import { currentOrg } from '$lib/utils/store/org'; + import { ChevronRight } from 'carbon-icons-svelte'; + import ProfileMenu from '$lib/components/Org/ProfileMenu/index.svelte'; interface SideLinks { name: string; @@ -73,70 +74,87 @@ }; - + + + +
    diff --git a/apps/dashboard/src/lib/components/LMS/components/Profile.svelte b/apps/dashboard/src/lib/components/LMS/components/Profile.svelte index 4668376f..a8114286 100644 --- a/apps/dashboard/src/lib/components/LMS/components/Profile.svelte +++ b/apps/dashboard/src/lib/components/LMS/components/Profile.svelte @@ -7,7 +7,6 @@ import { supabase } from '$lib/utils/functions/supabase'; import { profile } from '$lib/utils/store/user'; import { snackbar } from '$lib/components/Snackbar/store'; - import LogoutButton from '$lib/components/Buttons/Logout/index.svelte'; import generateUUID from '$lib/utils/functions/generateUUID'; import { t } from '$lib/utils/functions/translations'; import LanguagePicker from '$lib/components/Org/Settings/LanguagePicker.svelte'; @@ -120,6 +119,5 @@ isDisabled={loading} onClick={handleUpdate} /> - diff --git a/apps/dashboard/src/lib/components/Org/ProfileMenu/Menu.svelte b/apps/dashboard/src/lib/components/Org/ProfileMenu/Menu.svelte new file mode 100644 index 00000000..568bd0bd --- /dev/null +++ b/apps/dashboard/src/lib/components/Org/ProfileMenu/Menu.svelte @@ -0,0 +1,165 @@ + + +
    + + {#if !$globalStore.isOrgSite} + + {/if} + + + {#if !$globalStore.isOrgSite} + + {/if} + + +
    diff --git a/apps/dashboard/src/lib/components/Org/ProfileMenu/index.svelte b/apps/dashboard/src/lib/components/Org/ProfileMenu/index.svelte new file mode 100644 index 00000000..1239b05f --- /dev/null +++ b/apps/dashboard/src/lib/components/Org/ProfileMenu/index.svelte @@ -0,0 +1,31 @@ + + +{#if $isMobile} + ($profileMenu.open = false)} + width="w-4/5" + containerClass="h-full !max-h-[70vh] pt-0 pb-2" + headerClass="py-1" + > + + +{:else} + { + console.log('on:click:outside'); + $profileMenu.open = !!$profileMenu.ref?.contains(detail.target); + }} + > + + +{/if} diff --git a/apps/dashboard/src/lib/components/Org/Settings/Profile.svelte b/apps/dashboard/src/lib/components/Org/Settings/Profile.svelte index 1fd4327f..2ae456df 100644 --- a/apps/dashboard/src/lib/components/Org/Settings/Profile.svelte +++ b/apps/dashboard/src/lib/components/Org/Settings/Profile.svelte @@ -8,7 +8,6 @@ import { supabase } from '$lib/utils/functions/supabase'; import { profile } from '$lib/utils/store/user'; import { snackbar } from '$lib/components/Snackbar/store'; - import LogoutButton from '$lib/components/Buttons/Logout/index.svelte'; import generateUUID from '$lib/utils/functions/generateUUID'; import { t } from '$lib/utils/functions/translations'; import LanguagePicker from './LanguagePicker.svelte'; @@ -129,6 +128,5 @@ isDisabled={loading} onClick={handleUpdate} /> - diff --git a/apps/dashboard/src/lib/components/Org/Settings/index.svelte b/apps/dashboard/src/lib/components/Org/Settings/index.svelte index 1a120aac..e9c439a3 100644 --- a/apps/dashboard/src/lib/components/Org/Settings/index.svelte +++ b/apps/dashboard/src/lib/components/Org/Settings/index.svelte @@ -21,24 +21,21 @@ function getSelectedByTab(tabKey = '') { const tab = tabs.find((t) => t.tabKey === tabKey); - return tab ? tab.key : 0; } - function changeRouteOnTabChange(key = 0) { + + function onTabChange(e) { + const key = e.detail; const tab = tabs.find((t) => t.key === key); if (tab) { - return goto(tab.href); + goto(tab.href); } } - onMount(() => { + $: if (browser) { + query = new URLSearchParams($page.url.search); + tabKey = query.get('tab') || ''; selected = getSelectedByTab(tabKey); - }); - - $: { - if (browser) { - changeRouteOnTabChange(selected); - } } $: { @@ -82,7 +79,7 @@ } - + {#each tabs as tab} {/each} diff --git a/apps/dashboard/src/lib/components/Org/SideBar.svelte b/apps/dashboard/src/lib/components/Org/SideBar.svelte index e452331a..30fe3d5e 100644 --- a/apps/dashboard/src/lib/components/Org/SideBar.svelte +++ b/apps/dashboard/src/lib/components/Org/SideBar.svelte @@ -2,7 +2,7 @@ import { page } from '$app/stores'; import HelpIcon from 'carbon-icons-svelte/lib/Help.svelte'; import ForumIcon from 'carbon-icons-svelte/lib/Forum.svelte'; - import { SettingsAdjust } from 'carbon-icons-svelte'; + import { ChevronRight, SettingsAdjust } from 'carbon-icons-svelte'; import PrimaryButton from '$lib/components/PrimaryButton/index.svelte'; import OrgSelector from '$lib/components/OrgSelector/OrgSelector.svelte'; import HomeIcon from '$lib/components/Icons/HomeIcon.svelte'; @@ -11,13 +11,15 @@ import SiteSettingsIcon from '$lib/components/Icons/SiteSettingsIcon.svelte'; import AudienceIcon from '$lib/components/Icons/AudienceIcon.svelte'; import Avatar from '$lib/components/Avatar/index.svelte'; - import { currentOrgPath, currentOrgPlan, isFreePlan } from '$lib/utils/store/org'; + import { currentOrgPath, isFreePlan } from '$lib/utils/store/org'; + import { isOrgAdmin } from '$lib/utils/store/org'; import { profile } from '$lib/utils/store/user'; import { NavClasses } from '$lib/utils/constants/reusableClass'; - import { sideBar } from './store'; + import { sideBar, profileMenu } from './store'; import { t } from '$lib/utils/functions/translations'; import { goto } from '$app/navigation'; + import ProfileMenu from '$lib/components/Org/ProfileMenu/index.svelte'; interface menuItems { label: string; @@ -45,43 +47,6 @@ goto(window.location.pathname + '?upgrade=true'); }; - // $: { - // menuItems = [ - // { - // path: '', - // label: 'Dashboard', - // show: true - // }, - // // { - // // path: '/quiz', - // // label: 'Quizzes' - // // }, - // { - // path: '/courses', - // label: 'Courses', - // show: true - // }, - // { - // path: '/community', - // label: 'Community', - // show: true - // }, - // // { - // // path: '/site', - // // label: 'Site settings', - // // }, - // { - // path: '/audience', - // label: 'Audience', - // show: true - // }, - // { - // path: '/setup', - // label: 'Setup', - // show: $isOrgAdmin - // } - // ]; - // } $: menuItems = [ { path: '', @@ -111,99 +76,110 @@ ]; - + +
    diff --git a/apps/dashboard/src/lib/components/Org/store.js b/apps/dashboard/src/lib/components/Org/store.ts similarity index 55% rename from apps/dashboard/src/lib/components/Org/store.js rename to apps/dashboard/src/lib/components/Org/store.ts index 8671ced3..a7b0a62e 100644 --- a/apps/dashboard/src/lib/components/Org/store.js +++ b/apps/dashboard/src/lib/components/Org/store.ts @@ -7,3 +7,11 @@ export const newOrgModal = writable({ export const sideBar = writable({ hidden: true }); + +export const profileMenu = writable<{ + ref?: HTMLDivElement; + open: boolean; +}>({ + ref: undefined, + open: false +}); diff --git a/apps/dashboard/src/lib/utils/translations/de.json b/apps/dashboard/src/lib/utils/translations/de.json index be58b221..d3c82d27 100644 --- a/apps/dashboard/src/lib/utils/translations/de.json +++ b/apps/dashboard/src/lib/utils/translations/de.json @@ -1326,6 +1326,17 @@ "specialization": { "course_tag": "Spezialisierung" }, + "profileMenu": { + "profile": "PROFIL", + "current_org": "AKTUELLE ORGANISATION", + "free_tools": "KOSTENLOSE WERKZEUGE", + "progress": "Fortschrittsbericht", + "timer": "Aktivitätstimer", + "tic_tac": "Tictac-Zehe", + "see_more": "Mehr sehen", + "whats_new": "Was ist neu", + "launch_week": "Startwoche" + }, "validations": { "invalid_type_error": "Darf nicht leer sein", "email": { diff --git a/apps/dashboard/src/lib/utils/translations/en.json b/apps/dashboard/src/lib/utils/translations/en.json index 2e42c210..5c65813e 100644 --- a/apps/dashboard/src/lib/utils/translations/en.json +++ b/apps/dashboard/src/lib/utils/translations/en.json @@ -49,7 +49,18 @@ "forgot": "Forgot password?", "login": "Log In" }, + "profileMenu": { + "profile": "PROFILE", + "current_org": "CURRENT ORGANIZATION", + "free_tools": "FREE TOOLS", + "progress": "Progress report", + "timer": "Activity timer", + "tic_tac": "Tictac toe", + "see_more": "See more", + "whats_new": "What's new", + "launch_week": "Launch week" + }, "settings": { "heading": "Settings", "subheadings": { diff --git a/apps/dashboard/src/lib/utils/translations/es.json b/apps/dashboard/src/lib/utils/translations/es.json index 0c2f5974..1121cb92 100644 --- a/apps/dashboard/src/lib/utils/translations/es.json +++ b/apps/dashboard/src/lib/utils/translations/es.json @@ -1326,6 +1326,17 @@ "specialization": { "course_tag": "Especialización" }, + "profileMenu": { + "profile": "PERFIL", + "current_org": "ORGANIZACIÓN ACTUAL", + "free_tools": "HERRAMIENTAS GRATUITAS", + "progress": "Informe de progreso", + "timer": "Temporizador de actividad", + "tic_tac": "dedo del pie tres en raya", + "see_more": "Ver más", + "whats_new": "Qué hay de nuevo", + "launch_week": "Semana de lanzamiento" + }, "validations": { "invalid_type_error": "No debe estar vacío", "email": { diff --git a/apps/dashboard/src/lib/utils/translations/fr.json b/apps/dashboard/src/lib/utils/translations/fr.json index 64b6163b..ccf73079 100644 --- a/apps/dashboard/src/lib/utils/translations/fr.json +++ b/apps/dashboard/src/lib/utils/translations/fr.json @@ -1326,6 +1326,17 @@ "specialization": { "course_tag": "Spécialisation" }, + "profileMenu": { + "profile": "PROFIL", + "current_org": "ORGANISATION ACTUELLE", + "free_tools": "OUTILS GRATUITS", + "progress": "Rapport d'étape", + "timer": "Minuterie d'activité", + "tic_tac": "Tic-tac", + "see_more": "Voir plus", + "whats_new": "Quoi de neuf", + "launch_week": "Semaine de lancement" + }, "validations": { "invalid_type_error": "Ne doit pas être vide", "email": { diff --git a/apps/dashboard/src/lib/utils/translations/hi.json b/apps/dashboard/src/lib/utils/translations/hi.json index 9ae3539a..5aa96334 100644 --- a/apps/dashboard/src/lib/utils/translations/hi.json +++ b/apps/dashboard/src/lib/utils/translations/hi.json @@ -1326,6 +1326,17 @@ "specialization": { "course_tag": "विशेषज्ञता" }, + "profileMenu": { + "profile": "प्रोफ़ाइल", + "current_org": "वर्तमान संघ", + "free_tools": "मुफ़्त उपकरण", + "progress": "प्रगति रिपोर्ट", + "timer": "गतिविधि टाइमर", + "tic_tac": "टिक टीएसी को पैर की अंगुली", + "see_more": "और देखें", + "whats_new": "नया क्या है", + "launch_week": "लॉन्च सप्ताह" + }, "validations": { "invalid_type_error": "खाली नहीं होना चाहिए", "email": { diff --git a/apps/dashboard/src/lib/utils/translations/pt.json b/apps/dashboard/src/lib/utils/translations/pt.json index a41b3ea2..3dfe7fd8 100644 --- a/apps/dashboard/src/lib/utils/translations/pt.json +++ b/apps/dashboard/src/lib/utils/translations/pt.json @@ -1326,6 +1326,17 @@ "specialization": { "course_tag": "Especialização" }, + "profileMenu": { + "profile": "PERFIL", + "current_org": "ORGANIZAÇÃO ATUAL", + "free_tools": "FERRAMENTAS GRATUITAS", + "progress": "Relatório de progresso", + "timer": "Temporizador de atividade", + "tic_tac": "Jogo da velha", + "see_more": "Ver mais", + "whats_new": "O que há de novo", + "launch_week": "Semana de lançamento" + }, "validations": { "invalid_type_error": "Não deve estar vazio", "email": { diff --git a/apps/dashboard/src/lib/utils/translations/ru.json b/apps/dashboard/src/lib/utils/translations/ru.json index 61a452e3..77a13a34 100644 --- a/apps/dashboard/src/lib/utils/translations/ru.json +++ b/apps/dashboard/src/lib/utils/translations/ru.json @@ -1326,6 +1326,17 @@ "specialization": { "course_tag": "Специализация" }, + "profileMenu": { + "profile": "ПРОФИЛЬ", + "current_org": "ТЕКУЩАЯ ОРГАНИЗАЦИЯ", + "free_tools": "БЕСПЛАТНЫЕ ИНСТРУМЕНТЫ", + "progress": "Отчет о ходе работы", + "timer": "Таймер активности", + "tic_tac": "Крестики-нолики", + "see_more": "Узнать больше", + "whats_new": "Что нового", + "launch_week": "Неделя запуска" + }, "validations": { "invalid_type_error": "Не должно быть пустым", "email": { diff --git a/apps/dashboard/src/lib/utils/translations/vi.json b/apps/dashboard/src/lib/utils/translations/vi.json index 6e575a81..450ae9cf 100644 --- a/apps/dashboard/src/lib/utils/translations/vi.json +++ b/apps/dashboard/src/lib/utils/translations/vi.json @@ -1326,6 +1326,17 @@ "specialization": { "course_tag": "Chuyên môn" }, + "profileMenu": { + "profile": "HỒ SƠ", + "current_org": "TỔ CHỨC HIỆN TẠI", + "free_tools": "CÔNG CỤ MIỄN PHÍ", + "progress": "Báo cáo tiến trình", + "timer": "Hẹn giờ hoạt động", + "tic_tac": "TIC Tac Toe", + "see_more": "Xem thêm", + "whats_new": "Có gì mới", + "launch_week": "Tuần ra mắt" + }, "validations": { "invalid_type_error": "Không được để trống", "email": { diff --git a/apps/dashboard/src/routes/org/[slug]/+layout.svelte b/apps/dashboard/src/routes/org/[slug]/+layout.svelte index e4d627ef..44627243 100644 --- a/apps/dashboard/src/routes/org/[slug]/+layout.svelte +++ b/apps/dashboard/src/routes/org/[slug]/+layout.svelte @@ -10,6 +10,8 @@ export let data; + let ref = null; + $: if ($currentOrg.id && data.orgName === '*') { const newUrl = $page.url.pathname.replace('*', $currentOrg.siteName); goto(newUrl + $page.url.search); diff --git a/apps/dashboard/src/routes/profile/[id]/+page.svelte b/apps/dashboard/src/routes/profile/[id]/+page.svelte index 2b3b6ce2..67c43955 100644 --- a/apps/dashboard/src/routes/profile/[id]/+page.svelte +++ b/apps/dashboard/src/routes/profile/[id]/+page.svelte @@ -2,7 +2,6 @@ import UserAvatarIcon from 'carbon-icons-svelte/lib/UserAvatar.svelte'; import BookIcon from 'carbon-icons-svelte/lib/Book.svelte'; import TextField from '$lib/components/Form/TextField.svelte'; - import LogoutButton from '$lib/components/Buttons/Logout/index.svelte'; import PrimaryButton from '$lib/components/PrimaryButton/index.svelte'; import UploadImage from '$lib/components/UploadImage/index.svelte'; import { supabase } from '$lib/utils/functions/supabase'; @@ -193,7 +192,6 @@
    -