Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dark mode feature #789

Open
wants to merge 36 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
82f00c3
added button to trigger dark mode, and added dark mode to the navbar …
tomasoignons Sep 22, 2024
284f8c7
commit merge
tomasoignons Sep 26, 2024
81d2042
added dark theme for the home page
tomasoignons Sep 26, 2024
a38d530
added dark mode for the task creation form
tomasoignons Sep 26, 2024
a0639ee
added dark theme for the information page
tomasoignons Sep 26, 2024
8b769fe
added dark mode for buttons and cards
tomasoignons Sep 26, 2024
434dafd
added dark theme for discollaborative
tomasoignons Sep 26, 2024
2dc77f2
adding more dark theme to the task creation form
tomasoignons Sep 26, 2024
ef47767
merging
tomasoignons Sep 30, 2024
14b9505
make the text on the home page brighter
tomasoignons Sep 30, 2024
3d139bd
make the text on the information tab brighter
tomasoignons Sep 30, 2024
43c934f
text for the progressbar brighter, and orange icon included in the da…
tomasoignons Sep 30, 2024
4a812c0
changed the color of the buttons title in the dark mode to make them …
tomasoignons Sep 30, 2024
893dbe5
make the title of the discollaborative lighter
tomasoignons Sep 30, 2024
7901048
added a background to the 2 gifs in the information page
tomasoignons Sep 30, 2024
7a2ac3b
added a background to the disco logo on the main page
tomasoignons Sep 30, 2024
e5183ba
added the dark theme for file selector
tomasoignons Sep 30, 2024
fc20552
added comment on the source of the sun icon, and removed default boot…
tomasoignons Sep 30, 2024
09a3728
removed unused classes
tomasoignons Sep 30, 2024
c8619c8
added dark theme for all the testing features
tomasoignons Oct 1, 2024
70ce3be
transformed ref into a normal boolean, because it has to restart the …
tomasoignons Oct 1, 2024
48bfba6
removing some console.log and some unused variables
tomasoignons Oct 1, 2024
43b14ec
removed unused variables
tomasoignons Oct 1, 2024
855048d
merging a pull
tomasoignons Oct 3, 2024
81f9bc7
changed logo padding to 8, to not have a big blank, especially visibl…
tomasoignons Oct 3, 2024
9c4fd2c
keep the text dark in the home page, when there is light theme
tomasoignons Oct 3, 2024
c24ea4e
remove old legacy code
tomasoignons Oct 3, 2024
ec4911c
commit merge
tomasoignons Oct 3, 2024
91fb595
remove legacy code
tomasoignons Oct 3, 2024
1f7625a
made the text clearer
tomasoignons Oct 3, 2024
80e9d85
added dark mode support for prediction of type tabular
tomasoignons Oct 3, 2024
2908a66
modify the demo banner for the gpt task to make it color right in dar…
tomasoignons Oct 3, 2024
864d00c
made the discollaborative title lighter in dark mode in the discollab…
tomasoignons Oct 3, 2024
56ff09d
fixed the charts to make the axes brigters, and modify the tooltip to…
tomasoignons Oct 3, 2024
29fc860
added some spaces where the term discollaborative was (just needed to…
tomasoignons Oct 3, 2024
29aaf86
commit for merge
tomasoignons Oct 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion webapp/src/assets/svg/MoonIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
stroke="currentColor"
:class="customClass"
:viewBox="viewBox"
stroke-width="2"
>
<path
stroke-linecap="round"
Expand All @@ -19,7 +20,7 @@ export default {
name: 'MoonIcon',
props: {
customClass: {
default: 'w-6 h-6',
tomasoignons marked this conversation as resolved.
Show resolved Hide resolved
default: 'bi bi-info-circle w-7 h-7',
type: String
},
viewBox: { default: '0 0 24 24', type: String }
Expand Down
28 changes: 28 additions & 0 deletions webapp/src/assets/svg/SunIcon.vue
tomasoignons marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<!-- This SVG came from https://tablericons.com/, a website that provides open source svg -->
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
stroke="currentColor"
:class="customClass"
:viewBox="viewBox"
stroke-width="2"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" />
<path d="M6 6h3.5l2.5 -2.5l2.5 2.5h3.5v3.5l2.5 2.5l-2.5 2.5v3.5h-3.5l-2.5 2.5l-2.5 -2.5h-3.5v-3.5l-2.5 -2.5l2.5 -2.5z" />
</svg>
</template>
<script lang="ts">
export default {
name: 'SunIcon',
props: {
customClass: {
default: 'w-8 h-8',
type: String
},
viewBox: { default: '0 0 24 24', type: String }
}
}
</script>

4 changes: 4 additions & 0 deletions webapp/src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
antialiased
text-slate-900
bg-slate-100
dark:bg-slate-900
dark:text-slate-100
"
>
<!-- Sidebar -->
Expand All @@ -18,7 +20,9 @@
z-20
flex flex-shrink-0
bg-white
dark:bg-slate-800
border-r
dark:border-slate-900
md:static
focus:outline-none
"
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/containers/BaseLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<slot />
</main>

<footer class="flex items-center p-4 bg-white border-t text-slate-500">
<footer class="flex items-center p-4 bg-white dark:bg-slate-800 border-t dark:border-slate-900 text-slate-500 dark:text-slate-300">
<div class="flex mx-auto space-x-6 items-center">
<a
class="fa-brands fa-github fa-xl"
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/components/containers/ButtonsCard.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div
class="flex flex-col p-7 gap-4 bg-white rounded-lg transition duration-200 group hover:-translate-y-1 hover:scale-[101%] hover:outline hover:outline-2 hover:outline-disco-cyan hover:cursor-pointer"
class="flex flex-col p-7 gap-4 bg-white dark:bg-slate-950 rounded-lg transition duration-200 group hover:-translate-y-1 hover:scale-[101%] hover:outline hover:outline-2 hover:outline-disco-cyan dark:hover:outline-disco-dark-cyan hover:cursor-pointer"
>
<div class="flex flex-row">
<div
class="grow text-xl text-disco-blue group-hover:text-disco-cyan"
class="grow text-xl text-disco-blue dark:text-slate-300 group-hover:text-disco-cyan dark:group-hover:text-disco-light-cyan"
:class="`text-${titleAlign}`"
>
<slot name="title" />
Expand All @@ -13,7 +13,7 @@
<div><slot name="icon" /></div>
</div>

<div class="text-slate-500">
<div class="text-slate-500 dark:text-slate-300">
<slot />
</div>

Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/containers/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
export default {
name: 'CardItem',
props: {
customClass: { default: 'bg-white', type: String }
customClass: { default: 'bg-white dark:bg-slate-950', type: String }
}
}
</script>
4 changes: 2 additions & 2 deletions webapp/src/components/containers/DropdownCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="grid grid-cols-1 space-y-8 lg:gap-8 rounded-xl group/super">
<div class="col-span-1 bg-white rounded-xl">
<div class="col-span-1 bg-white dark:bg-slate-950 rounded-xl">
<IconCardHeader>
<template #title>
<button class="focus:outline-none" @click="toggle">
Expand All @@ -16,7 +16,7 @@
</template>
</IconCardHeader>

<div v-show="opened" class="text-sm text-slate-500 p-8 border-t">
<div v-show="opened" class="text-sm text-slate-500 dark:text-slate-300 p-8 border-t">
<slot />
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/containers/IconCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
class="grid grid-cols-1 space-y-8 lg:gap-8 rounded-xl group/super"
:class="fillSpace ? 'min-w-full lg:min-w-[42rem]': ''"
>
<div class="col-span-1 bg-white rounded-xl">
<div class="col-span-1 bg-white dark:bg-slate-950 rounded-xl">
<IconCardHeader :title-placement="titlePlacement">
<template #title> <slot name="title" /> </template>
<template #icon> <slot name="icon" /> </template>
</IconCardHeader>

<div class="text-sm text-slate-500 p-8 border-t">
<div class="text-sm text-slate-500 dark:text-slate-200 p-8 border-t">
<slot />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/containers/IconCardHeader.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="flex items-center justify-between p-4 md:p-6">
<h4
class="flex w-full text-xl text-disco-blue group-hover/super:text-disco-cyan"
class="flex w-full text-xl text-disco-blue dark:text-disco-light-blue group-hover/super:text-disco-cyan"
:class="`justify-${titlePlacement} text-${titlePlacement}`"
>
<slot name="title" />
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/containers/IconCardSmall.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div
class="flex items-center justify-between p-4 bg-white rounded-md"
class="flex items-center justify-between p-4 bg-white dark:bg-slate-950 rounded-md"
>
<div>
<h6
class="text-xs font-medium leading-none tracking-wider text-gray-500 uppercase"
class="text-xs font-medium leading-none tracking-wider text-gray-500 dark:text-gray-300 uppercase"
>
{{ header }}
</h6>
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/containers/ImageCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
class="grid grid-cols-1 w-full bg-white aspect-square rounded-xl drop-shadow-md hover:drop-shadow-xl transition duration-500 hover:scale-105 opacity-70 hover:opacity-100 shadow hover:shadow-lg"
class="grid grid-cols-1 w-full bg-white dark:bg-slate-800 aspect-square rounded-xl drop-shadow-md hover:drop-shadow-xl transition duration-500 hover:scale-105 opacity-70 hover:opacity-100 shadow hover:shadow-lg"
>
<div class="grid grid-cols-1 gap-1 text-center content-center p-2 h-16">
<slot name="title" />
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/components/dataset_input/FileSelection.vue
tomasoignons marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<article
aria-label="File Upload Model"
class="h-full flex flex-col bg-white rounded-lg"
class="h-full flex flex-col bg-white dark:bg-slate-950 rounded-lg"
@drop.prevent
@dragover.prevent
@dragenter.prevent
Expand All @@ -18,12 +18,12 @@
@dragleave="onDragLeave"
@drop="async (e: DragEvent) => await dragFiles(e)"
>
<p class="p-4 text-lg text-disco-blue flex-wrap justify-center">
<p class="p-4 text-lg text-disco-blue dark:text-disco-light-blue flex-wrap justify-center">
<span>Drag and drop the {{ fileType }} or</span>
</p>
<label class="mb-6">
<span
class="px-4 py-2 min-w-[8rem] text-lg uppercase text-white bg-disco-cyan rounded duration-200 hover:bg-white hover:outline hover:outline-disco-cyan hover:outline-2 hover:text-disco-cyan hover:cursor-pointer"
class="px-4 py-2 min-w-[8rem] text-lg uppercase text-white bg-disco-cyan rounded duration-200 hover:bg-white hover:dark:bg-slate-950 hover:outline hover:outline-disco-cyan hover:outline-2 hover:text-disco-cyan hover:cursor-pointer"
>
select {{ fileType }}
</span>
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/components/home/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
href="https://framaforms.org/disco-feedback-form-1718716636"
>
<div class="flex flex-row flex-wrap shrink-0 items-center gap-x-2 justify-end">
<p class="text-disco-blue font-bold text-xs hover:underline hover:text-disco-cyan text-end">Give us some feedback</p>
<p class="text-disco-blue font-bold text-xs hover:underline hover:text-disco-cyan text-end dark:text-disco-dark-cyan">Give us some feedback</p>
<FeedbackIcon custom-class="min-w-8 min-h-8 w-8 h-8"/>
</div>
</a>
</div>
<!-- Disco logo -->
<div class="flex flex-col justify-center items-center mb-8 space-y-4">
<div class="md:max-w-md lg:max-w-lg">
<DiscoGIF/>
<DiscoGIF class="bg-slate-100 rounded-lg pb-16 px-4"/>
tomasoignons marked this conversation as resolved.
Show resolved Hide resolved
</div>
<span class="text-lg md:text-2xl lg:text-3xl text-center text-slate-600">
<span class="text-lg md:text-2xl lg:text-3xl text-center text-slate-300">
tomasoignons marked this conversation as resolved.
Show resolved Hide resolved
<span class="font-disco text-disco-cyan font-semibold">DIS</span
>tributed
<span class="font-disco text-disco-blue font-semibold">CO</span
Expand Down
10 changes: 5 additions & 5 deletions webapp/src/components/information/Information.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<!-- Page Content -->
<Card class="flex flex-col place-content-center p-4 space-y-6 rounded-xl ">
<p class="flex flex-wrap justify-center text-2xl text-slate-400 mt-2">
<span><span class="font-disco text-disco-cyan uppercase">dis</span><span>tributed</span>&nbsp;</span>
<p class="flex flex-wrap justify-center text-2xl text-slate-400 dark:text-slate-300 mt-2">
<span><span class="font-disco text-disco-cyan dark:text-disco-light-cyan uppercase">dis</span><span>tributed</span>&nbsp;</span>
<span><span class="font-disco text-disco-blue uppercase">co</span><span>llaborative learning platform</span></span>
</p>
<div class="grid gap-8 p-4 sm:grid-cols-2 text-slate-500 border-t">
<div class="grid gap-8 p-4 sm:grid-cols-2 text-slate-400 border-t">
<!-- Federated insight -->
<div class="flex flex-col items-center">
<h6
Expand All @@ -20,7 +20,7 @@
>
Federated Learning
</h6>
<FederatedGIF class="my-md" />
<FederatedGIF class="my-md bg-slate-100 rounded-lg border-slate-300 border-4" />
tomasoignons marked this conversation as resolved.
Show resolved Hide resolved
<p class="text-sm py-6 text-center">
The server puts in common local model updates and sends back an aggregated global model. <br/>No data is shared.
</p>
Expand All @@ -39,7 +39,7 @@
>
Decentralized Learning
</h6>
<DecentralizedGIF class="my-md" />
<DecentralizedGIF class="my-md bg-slate-100 rounded-lg border-slate-300 border-4" />
tomasoignons marked this conversation as resolved.
Show resolved Hide resolved
<p class="text-sm py-6 text-center">
Local model aggregation is coordinated between peers without any server.
<br/> No data is shared.
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/progress_bars/InformationBar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="mb-4 space-y-4">
<div class="flex flex-wrap text-3xl text-slate-600 justify-center">
tomasoignons marked this conversation as resolved.
Show resolved Hide resolved
<div class="flex flex-wrap text-3xl justify-center">
<DISCO />
</div>
<div class="hidden md:inline-block w-full">
Expand Down
8 changes: 4 additions & 4 deletions webapp/src/components/progress_bars/ProgressIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@
>
<div
class="w-full rounded items-center align-middle align-center flex-1 transition duration-400"
:class="props.active ? 'bg-disco-blue' : 'bg-slate-200'"
:class="props.active ? 'bg-disco-blue dark:bg-disco-light-blue' : 'bg-slate-200 dark:bg-slate-600'"
>
<div class="py-1" />
</div>
</div>
<div
class="transition duration-400 w-10 h-10 mx-auto rounded-full text-lg text-white flex items-center hover:scale-105 hover:cursor-pointer"
:class="(props.active ? 'bg-disco-blue border-4 border-slate-200' : 'bg-white border-4 border-slate-200') + (isCurrentStep ? ' bg-orange-300' : '') "
tomasoignons marked this conversation as resolved.
Show resolved Hide resolved
:class="(props.active ? 'bg-disco-blue dark:bg-disco-light-blue border-4 border-slate-200 dark:border-slate-600' : 'bg-white dark:bg-slate-800 border-4 border-slate-200 dark:border-slate-600') + (isCurrentStep ? ' bg-orange-300 dark:bg-orange-400' : '') "
>
<span
class="text-center w-full"
:class="props.active ? 'text-white' : 'text-slate-500'"
:class="props.active ? 'text-white dark:text-white' : 'text-slate-500 dark:text-slate-200'"
>
<slot name="icon" />
</span>
</div>
</div>
<!-- Text -->
<div class="text-xs text-center md:text-base text-slate-700">
<div class="text-xs text-center md:text-base text-slate-700 dark:text-slate-400">
<slot name="text" />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/progress_bars/TrainingBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
v-if="taskTitle !== undefined && displayTitle"
class="flex flex-wrap font-disco text-3xl justify-center"
>
<span class="text-disco-blue">{{ taskTitle }}</span>
<span class="text-disco-blue dark:text-disco-light-cyan">{{ taskTitle }}</span>
tomasoignons marked this conversation as resolved.
Show resolved Hide resolved
</div>
<div
v-else
Expand Down
32 changes: 31 additions & 1 deletion webapp/src/components/sidebar/SideBar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<!-- Mini Sidebar (LHS) -->
<nav class="flex flex-col flex-shrink-0 h-full sm:px-4 px-2 py-4 border-r">
<nav class="flex flex-col flex-shrink-0 h-full sm:px-4 px-2 py-4 border-r dark:border-black">
<!-- Brand -->
<div class="hidden sm:flex flex-shrink-0">
<RouterLink
Expand Down Expand Up @@ -31,11 +31,21 @@
<SidebarButton to="/information" text="More on DISCO">
<InfoIcon />
</SidebarButton>

<SidebarButton
to=""
:text="currentTheme === 'light' ? 'Switch to Dark Mode' : 'Switch to Light Mode'"
@click="toggleDarkMode"
>
<MoonIcon v-if="currentTheme === 'light'"/>
<SunIcon v-else/>
</SidebarButton>
</div>
</nav>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { RouterLink } from "vue-router";

import HomeIcon from "@/assets/svg/HomeIcon.vue";
Expand All @@ -46,4 +56,24 @@ import InfoIcon from "@/assets/svg/InfoIcon.vue";
import DISCO from "@/components/simple/DISCO.vue";

import SidebarButton from "./SidebarButton.vue";
import MoonIcon from "@/assets/svg/MoonIcon.vue";
import SunIcon from "@/assets/svg/SunIcon.vue";

const currentTheme = ref(localStorage.getItem('theme') || 'light');
tomasoignons marked this conversation as resolved.
Show resolved Hide resolved

// Apply the initial theme on mount
onMounted(() => {
if (currentTheme.value === 'dark') {
document.documentElement.classList.add('dark');
}
});
// Function to toggle the dark mode
const toggleDarkMode = () => {
const newTheme = currentTheme.value === 'light' ? 'dark' : 'light';
document.documentElement.classList.toggle('dark', newTheme === 'dark');
localStorage.setItem('theme', newTheme);
currentTheme.value = newTheme;
};


</script>
2 changes: 1 addition & 1 deletion webapp/src/components/sidebar/SidebarButton.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="p-2 text-slate-500">
<div class="p-2 text-slate-500 dark:text-slate-200">
<span class="sr-only"> {{ text }} </span>
<RouterLink
:to="to"
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/simple/CustomButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
text-lg uppercase text-white
bg-disco-cyan
rounded duration-200
hover:bg-white hover:outline hover:outline-disco-cyan hover:outline-2 hover:text-disco-cyan"
hover:bg-white dark:hover:bg-black hover:outline hover:outline-disco-cyan dark:hover:outline-disco-light-cyan hover:outline-2 hover:text-disco-cyan dark:hover:text-disco-light-cyan"
>
<slot />
<!-- Optional description slot -->
Expand Down
1 change: 1 addition & 0 deletions webapp/src/components/task_creation_form/TaskForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
class="
inline
text-slate-600
dark:text-slate-200
font-bold
md:text-right
mb-1
Expand Down
Loading