Skip to content

Commit

Permalink
Merge branch 'main' into jmc/16_schemes_list
Browse files Browse the repository at this point in the history
  • Loading branch information
johnatawnclementawn authored Dec 3, 2024
2 parents 11ca65c + 82e7d1f commit c03732e
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Add login interface [#13](https://github.com/archesproject/arches-lingo/issues/13)
- Add front-end router [#11](https://github.com/archesproject/arches-lingo/issues/11)
- Add dark mode toggle [#91](https://github.com/archesproject/arches-lingo/issues/91)
- Add concept and scheme serializers [#103](https://github.com/archesproject/arches-lingo/issues/103)
- Add backend for search [#67](https://github.com/archesproject/arches-lingo/issues/67)
- Add concept and scheme pages [#15](https://github.com/archesproject/arches-lingo/issues/15)
Expand Down
10 changes: 9 additions & 1 deletion arches_lingo/src/arches_lingo/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,15 @@ router.beforeEach(async (to, _from, next) => {
</div>
</div>
</main>
<Toast />
<Toast
:pt="{
summary: { fontSize: 'medium' },
detail: { fontSize: 'small' },
messageIcon: {
style: { marginTop: 'var(--p-toast-messageicon-margintop)' },
},
}"
/>
</template>

<style scoped>
Expand Down
38 changes: 38 additions & 0 deletions arches_lingo/src/arches_lingo/components/header/DarkModeToggle.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<script setup lang="ts">
import { ref } from "vue";
import { useGettext } from "vue3-gettext";
import { Theme } from "@primeuix/styled";
import ToggleButton from "primevue/togglebutton";
const { $gettext } = useGettext();
const darkModeClass = Theme.options.darkModeSelector.substring(1);
const isDarkModeEnabled = ref(
document.documentElement.classList.contains(darkModeClass),
);
function toggleDarkMode() {
document.documentElement.classList.toggle(darkModeClass);
isDarkModeEnabled.value = !isDarkModeEnabled.value;
localStorage.setItem(
`arches.${darkModeClass}`,
isDarkModeEnabled.value.toString(),
);
}
</script>

<template>
<ToggleButton
:model-value="isDarkModeEnabled"
:on-label="$gettext('Dark')"
:off-label="$gettext('Light')"
off-icon="pi pi-sun"
on-icon="pi pi-moon"
:pt="{
root: { ariaLabel: $gettext('Toggle dark mode') },
label: { style: { display: 'none' } },
}"
@click="toggleDarkMode"
/>
</template>
18 changes: 12 additions & 6 deletions arches_lingo/src/arches_lingo/components/header/PageHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useGettext } from "vue3-gettext";
import Menubar from "primevue/menubar";
import { routeNames } from "@/arches_lingo/routes.ts";
import DarkModeToggle from "@/arches_lingo/components/header/DarkModeToggle.vue";
import UserInteraction from "@/arches_lingo/components/user/UserInteraction.vue";
import SearchDialog from "@/arches_lingo/components/header/SearchDialog.vue";
Expand All @@ -21,15 +22,15 @@ const items = ref([

<template>
<Menubar
class="page-header"
:model="items"
style="border-radius: 0"
>
<template #start>
<RouterLink
:to="{ name: routeNames.root }"
style="text-decoration: none; color: inherit"
>
<h2>{{ $gettext("Arches Lingo") }}</h2>
<h1>{{ $gettext("Arches Lingo") }}</h1>
</RouterLink>
<SearchDialog />
</template>
Expand All @@ -43,18 +44,23 @@ const items = ref([
:class="item.icon"
aria-hidden="true"
></i>
<span>{{ item.label }}</span>
<span style="font-weight: var(--p-button-label-font-weight)">
{{ item.label }}
</span>
</RouterLink>
</template>
<template #end>
<UserInteraction />
<div style="display: flex; align-items: center; gap: 1rem">
<DarkModeToggle />
<UserInteraction />
</div>
</template>
</Menubar>
</template>

<style scoped>
.page-header {
border-radius: 0;
:deep(.p-menubar-start) {
gap: var(--p-menubar-gap);
}
@media screen and (max-width: 960px) {
Expand Down
6 changes: 6 additions & 0 deletions arches_lingo/src/arches_lingo/components/login/LoginLinks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useGettext } from "vue3-gettext";
import Button from "primevue/button";
import { SECONDARY } from "@/arches_lingo/constants.ts";
const { $gettext } = useGettext();
</script>

Expand All @@ -13,11 +15,15 @@ const { $gettext } = useGettext();
as="a"
:label="$gettext('Register')"
:href="arches.urls.signup"
:severity="SECONDARY"
:outlined="true"
/>
<Button
as="a"
:label="$gettext('Multi-factor login')"
:href="arches.urls.auth + '?next=/'"
:severity="SECONDARY"
:outlined="true"
/>
</div>
</template>
6 changes: 3 additions & 3 deletions arches_lingo/src/arches_lingo/components/sidenav/SideNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ const items = ref([
display: flex;
flex-direction: column;
align-items: center;
min-width: 3rem;
min-width: var(--p-button-icon-only-width);
border-right: 1px solid var(--p-menubar-border-color);
}
.p-button {
min-height: 3rem;
min-width: 3rem;
min-height: var(--p-button-icon-only-width);
min-width: var(--p-button-icon-only-width);
border-radius: 0;
font-size: 1.5rem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ const greeting = computed(() => {
</script>

<template>
<div style="display: flex; align-items: center">
<div style="display: flex; align-items: center; gap: 1rem">
<span v-if="user">{{ greeting }}</span>
<Button
style="margin-left: 1rem"
:label="$gettext('Sign out')"
@click="issueLogout"
>
{{ $gettext("Sign out") }}
</Button>
></Button>
</div>
</template>

0 comments on commit c03732e

Please sign in to comment.