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

Layout changes #156

Merged
merged 6 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import NavBar from "@/components/navigation/NavBar.vue";
import { computed, onBeforeMount, ref } from "vue";
import { useI18n } from "vue-i18n";
import { useLocale } from "@/stores/locale-store";
import { useThemeStore } from "@/stores/theme-store";
import { useTheme } from "vuetify";

const navBar = ref<InstanceType<typeof NavBar> | null>(null);

Expand All @@ -28,6 +30,15 @@ const hideHeader = computed(() => currentRoute.meta.hideHeader);
onBeforeMount(() => {
const { locale } = useI18n();
const { selectedLocale } = useLocale();
const { storedTheme } = useThemeStore();
const theme = useTheme();
locale.value = selectedLocale;
theme.global.name.value = storedTheme;
});
</script>

<style>
.v-main {
background-color: rgb(var(--v-theme-background));
}
</style>
2 changes: 1 addition & 1 deletion frontend/src/assets/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
--color-primary-dark: color-mod(var(--color-primary) shade(15%));
--color-primary-bg: color-mod(var(--color-primary) alpha(30));

--color-secondary: #dfe5f7;
--color-secondary: #ebeffb;

--color-accent: #ffd200;
--color-accent-light: color-mod(var(--color-accent) tint(15%));
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 15 additions & 4 deletions frontend/src/components/ApolloHeader.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-app-bar>
<v-app-bar class="bg-primary elevation-1">
<v-app-bar-nav-icon variant="text" @click="emit('toggleNav')"></v-app-bar-nav-icon>
<RouterLink to="/">
<img alt="Logo" class="logo" src="@/assets/logo_white_transparant.png" />
Expand All @@ -10,15 +10,17 @@
<div class="leftContent" v-else>
<LogoutButton class="logout" v-if="isLoggedIn" />
<LocaleSwitcher />
<ThemeSwitcher class="switcher" />
</div>
</v-app-bar>
</template>

<script setup lang="ts">
import { RouterLink } from "vue-router";
import { useDisplay } from "vuetify";
import LocaleSwitcher from "./LocaleSwitcher.vue";
import LocaleSwitcher from "./switcher/LocaleSwitcher.vue";
import DropDownMobile from "@/components/navigation/DropDownMobile.vue";
import ThemeSwitcher from "@/components/switcher/ThemeSwitcher.vue";
import LogoutButton from "@/components/buttons/LogoutButton.vue";
import { useAuthStore } from "@/stores/auth-store";
import { storeToRefs } from "pinia";
Expand All @@ -39,15 +41,24 @@ const { isLoggedIn } = storeToRefs(useAuthStore());
}

.v-app-bar {
padding: 5px 0px;
padding: 5px 0;
}

.v-app-bar-nav-icon {
color: rgb(var(--v-theme-navtext));
}

.leftContent {
margin-left: auto;
display: flex;
align-items: center;
}

.logout {
margin-right: 15px;
color: rgb(var(--v-theme-navtext));
}

.switcher {
margin-left: 20px;
}
</style>
2 changes: 1 addition & 1 deletion frontend/src/components/buttons/LogoutButton.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-btn variant="text" class="logout" @click="logout"> logout </v-btn>
<v-btn variant="text" class="logout" @click="logout"> {{ $t("logout") }} </v-btn>
</template>

<script setup lang="ts">
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/components/home/cards/HomeScreenCard.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-card variant="text" :title="$t(title)" class="card">
<v-card :title="$t(title)" class="card" variant="flat">
<slot></slot>
</v-card>
</template>
Expand All @@ -12,8 +12,9 @@ defineProps<{

<style scoped>
.card {
background-color: white;
color: black;
border-radius: 20px;
background-color: rgb(var(--v-theme-secondary));
color: rgb(var(--v-theme-text));
border-radius: 2px;
text-transform: capitalize;
}
</style>
45 changes: 23 additions & 22 deletions frontend/src/components/home/listcontent/DeadlineItem.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div :class="getBackgroundClass()" @click="navigateToProject">
<div class="projectbtn" @click="navigateToProject">
<div :class="getBackgroundClass()"></div>
<div class="leftcontent">
<h3>{{ deadline.project.name }}</h3>
<p class="p">{{ deadline.project.subject_id }}</p>
Expand All @@ -23,7 +24,7 @@ const { deadline } = toRefs(props);

const getBackgroundClass = () => {
return {
projectbtn: true,
block: true,
accepted: deadline.value.status === "accepted",
rejected: deadline.value.status === "rejected",
none: deadline.value.status === "none",
Expand All @@ -47,39 +48,39 @@ const navigateToProject = () => {

<style scoped>
.projectbtn {
margin: 10px;
width: calc(100% - 20px);
background-color: white;
padding: 10px;
margin: 5px;
background-color: rgb(var(--v-theme-background));
display: flex;
align-items: center;
transition: background-color 0.3s;
border-radius: 10px;
align-items: center;
cursor: pointer;
height: 65px;
border-radius: 2px;
}

.none {
background-color: #eeeeee;
.projectbtn:hover {
background-color: rgb(var(--v-theme-tertiary));
}

.accepted {
background-color: #e3f7e4;
.block {
margin-left: 10px;
width: 5px;
height: 100%;
}

.rejected {
background-color: #ffcaca;
.none {
background-color: gray;
}

.accepted:hover {
background-color: #c3f2c6;
.accepted {
background-color: green;
}

.rejected:hover {
background-color: #ff9898;
.rejected {
background-color: darkred;
}

.none:hover {
background-color: lightgray;
.leftcontent {
margin-left: 20px;
}

.rightcontent {
Expand All @@ -89,6 +90,6 @@ const navigateToProject = () => {
}

.p {
color: lightslategrey;
color: rgb(var(--v-theme-textsecondary));
}
</style>
11 changes: 6 additions & 5 deletions frontend/src/components/home/listcontent/SubjectItem.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<template>
<v-divider></v-divider>
<div class="coursebtn" @click="navigateToCourse">
<div>
<h3>{{ subject.name }}</h3>
Expand Down Expand Up @@ -35,17 +34,19 @@ const navigateToCourse = () => {

<style scoped>
.coursebtn {
width: 100%;
background-color: white;
width: calc(100% - 10px);
margin: 5px;
padding: 10px;
display: flex;
align-items: center;
transition: background-color 0.3s;
cursor: pointer;
background-color: rgb(var(--v-theme-background));
border-radius: 2px;
}

.coursebtn:hover {
background-color: lightgray;
background-color: rgb(var(--v-theme-tertiary));
}

.chevron {
Expand All @@ -55,6 +56,6 @@ const navigateToCourse = () => {
}

.teacher {
color: lightslategrey;
color: rgb(var(--v-theme-textsecondary));
}
</style>
8 changes: 6 additions & 2 deletions frontend/src/components/navigation/DropDownList.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<template>
<v-list class="items">
<v-list class="items bg-primary">
<v-list-item data-test="logoutButton" v-if="loggedInValue.value">
<LogoutButton />
</v-list-item>
<v-list-item data-test="localeSwitcher">
<LocaleSwitcher />
</v-list-item>
<v-list-item data-test="themeSwitcher">
<themeSwitcher />
</v-list-item>
</v-list>
</template>

<script setup lang="ts">
import LocaleSwitcher from "@/components/LocaleSwitcher.vue";
import LocaleSwitcher from "@/components/switcher/LocaleSwitcher.vue";
import LogoutButton from "@/components/buttons/LogoutButton.vue";
import ThemeSwitcher from "@/components/switcher/ThemeSwitcher.vue";

import { useAuthStore } from "@/stores/auth-store";
import { storeToRefs } from "pinia";
Expand Down
12 changes: 3 additions & 9 deletions frontend/src/components/navigation/NavBar.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-navigation-drawer v-model="isOpen" app>
<v-navigation-drawer v-model="isOpen" app class="text-background">
<div class="navbuttons">
<NavButton
v-for="nav in navigations"
Expand All @@ -11,12 +11,7 @@
</div>
<template v-slot:append>
<div class="ugent-logo">
<img
alt="Logo"
class="logo"
src="@/assets/universiteit-gent-logo-white.png"
height="150"
/>
<img alt="Logo" class="logo" :src="`src/assets/${$t('logo')}`" height="150" />
</div>
</template>
</v-navigation-drawer>
Expand All @@ -42,13 +37,12 @@ defineExpose({

<style scoped lang="scss">
.v-navigation-drawer {
background: linear-gradient(var(--color-primary), #0e2057);
background: rgb(var(--v-theme-primary));
padding: 10px;
}

.ugent-logo {
bottom: 0;
margin-bottom: 30px;
}

.navbuttons {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/navigation/NavButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ defineProps<{
justify-content: space-between;
align-items: center;
width: 100%;
color: rgb(var(--v-theme-navtext));
text-transform: capitalize;
}

.v-icon {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div class="switcher">
<v-icon icon="mdi-earth" />
<template v-for="(availableLocale, index) in availableLocales" :key="availableLocale">
<v-btn
variant="text"
Expand Down Expand Up @@ -29,7 +28,7 @@ function handleLocaleChange(selectedLocale: string) {

<style lang="scss" scoped>
.switcher {
color: var(--color-text-on-primary);
color: rgb(var(--v-theme-navtext));
display: flex;
align-items: center;
}
Expand All @@ -39,7 +38,7 @@ function handleLocaleChange(selectedLocale: string) {
}

.selected-option {
color: var(--color-text-on-primary);
color: rgb(var(--v-theme-navtext));
font-style: bold;
}
</style>
41 changes: 41 additions & 0 deletions frontend/src/components/switcher/ThemeSwitcher.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<template>
<div class="container">
<v-icon class="moon" icon="mdi mdi-moon-waning-crescent"></v-icon>
<v-switch
class="switcher"
color="white"
v-model="switchValue"
false-value="darkTheme"
true-value="lightTheme"
></v-switch>
<v-icon class="sun" icon="mdi mdi-white-balance-sunny"></v-icon>
</div>
</template>

<script setup lang="ts">
import { useTheme } from "vuetify";
import { ref, watch } from "vue";
import { useThemeStore } from "@/stores/theme-store";
const theme = useTheme();
const { storedTheme, setTheme } = useThemeStore();

const switchValue = ref(storedTheme);

watch(switchValue, (newValue) => {
theme.global.name.value = newValue;
setTheme(newValue);
console.log(localStorage.getItem("theme"));
});
</script>

<style scoped>
.container {
display: flex;
align-items: center;
}
.switcher {
margin-left: 5px;
margin-right: 10px;
display: flex;
}
</style>
2 changes: 2 additions & 0 deletions frontend/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default {
loading_page: "Loading...",
},
},
logo: "ghent-university-logo-white.png",
logout: "logout",
login: {
about: "The official submission application of Ghent University",
login: "Login",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/i18n/locales/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default {
loading_page: "Aan het laden...",
},
},
logo: "universiteit-gent-logo-white.png",
logout: "uitloggen",
login: {
about: "De officiële indienapplicatie van de Universiteit Gent",
login: "Inloggen",
Expand Down
Loading
Loading