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

Upgrade controlled list manager to PrimeVue 4 #16

Merged
merged 46 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c8fc97c
Remove primevue override
jacobtylerwalls Sep 5, 2024
85e4d81
Fix primevue 4 breaking changes in ListTree.vue
jacobtylerwalls Jul 30, 2024
5a686a2
Fix typescript issues re: primevue 4
jacobtylerwalls Jul 30, 2024
692d901
InputSwitch -> ToggleSwitch
jacobtylerwalls Jul 30, 2024
805ffe5
Dropdown -> Select
jacobtylerwalls Jul 30, 2024
331b74a
PrimeVue 4 -- round 1 style fixes
jacobtylerwalls Jul 30, 2024
59aeb0d
Remove unnecessary styles
jacobtylerwalls Jul 30, 2024
902d2b9
Start extracting style constants
jacobtylerwalls Jul 30, 2024
762080b
Underline links, fix whitespace
jacobtylerwalls Jul 30, 2024
69b10a0
Improve color contrast
jacobtylerwalls Jul 30, 2024
fbf9e66
Fix pc* pass-throughs
jacobtylerwalls Jul 30, 2024
c4bc1e1
Prep for button theming
jacobtylerwalls Jul 30, 2024
57b4128
Further theming
jacobtylerwalls Jul 30, 2024
c8410f1
Adjust column widths
jacobtylerwalls Jul 30, 2024
d0ad2ae
Improve move icon alignment
jacobtylerwalls Jul 30, 2024
4e2740c
Fix primevue 4.0.1 breaking change
jacobtylerwalls Jul 30, 2024
281a75c
Observe accessibility mode on buttons
jacobtylerwalls Jul 30, 2024
3162301
Change primary color to sky
jacobtylerwalls Jul 30, 2024
30e4c2d
Consume theme from core arches
jacobtylerwalls Aug 9, 2024
5845edb
Use primitive color tokens from arches theme
jacobtylerwalls Aug 12, 2024
824b007
Avoid checking stylesheet name
jacobtylerwalls Aug 12, 2024
ff6f72d
Isolate arches CSS
jacobtylerwalls Aug 12, 2024
efe261e
Extract header font weight and sizes
jacobtylerwalls Aug 12, 2024
db0f29b
Consume css reset from core arches
jacobtylerwalls Aug 13, 2024
f7b4c68
Remove header variable
jacobtylerwalls Aug 19, 2024
0a1801c
Remove trailing slashes from URLs
jacobtylerwalls Jul 31, 2024
f726126
Standardize APIBase inheritance
jacobtylerwalls Aug 12, 2024
e0273ca
Implement front-end routing #4
jacobtylerwalls Jul 31, 2024
15186c7
Factor out `<MainSplitter>`
jacobtylerwalls Jul 31, 2024
072f514
Add ts-expect-error
jacobtylerwalls Aug 9, 2024
5390ec6
Fix issue links
jacobtylerwalls Aug 9, 2024
847fb44
Move navigation up one component
jacobtylerwalls Aug 13, 2024
eec4d7e
Move deep CSS selectors for headers
jacobtylerwalls Aug 13, 2024
fc02980
Factor out routes.ts
jacobtylerwalls Aug 19, 2024
bcfbe26
Group watch() together
jacobtylerwalls Aug 19, 2024
424ca81
Remove css-reset class
jacobtylerwalls Aug 20, 2024
eed3cb2
Adjust <h> styles
jacobtylerwalls Aug 20, 2024
bc603d0
Adjust DataTable font sizes
jacobtylerwalls Aug 20, 2024
a82b68d
Update gitignore for uploaded images
jacobtylerwalls Aug 20, 2024
d862f8b
Re-run updateproject
jacobtylerwalls Aug 27, 2024
e3c7a80
Fix typo interfering with new list input entry
jacobtylerwalls Aug 27, 2024
a19eb11
Avoid hardcoded plugin routes
jacobtylerwalls Aug 29, 2024
f318b3a
Cosmetic
jacobtylerwalls Aug 31, 2024
42b52f8
Simplify test
jacobtylerwalls Sep 4, 2024
dcb1d2d
Remove extra declarations file
jacobtylerwalls Sep 4, 2024
f300f06
Run eslint:fix
jacobtylerwalls Sep 5, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ arches_references/staticfiles
arches_references/media/packages
arches_references/media/build/
arches_references/uploadedfiles/*
arches_references/list_item_images
arches_references/settings_local.py
webpack-stats.json
.vscode/
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Added compatibility with PrimeVue 4 [#16](https://github.com/archesproject/arches-references/pull/16)
- Add compatibility with PrimeVue 4 [#9](https://github.com/archesproject/arches-references/issues/9)
- Add front-end routing [#4](https://github.com/archesproject/arches-references/issues/4)

### Changed
- Generate URIs when not supplied [#17](https://github.com/archesproject/arches-references/pull/17)
- Generate URIs when not supplied [#8](https://github.com/archesproject/arches-references/issues/8)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import ko from 'knockout';

import { routes } from '@/arches_references/routes.ts';
import ControlledListManager from '@/arches_references/plugins/ControlledListManager.vue';
import createVueApp from 'utils/create-vue-application';
import createVueApplication from 'utils/create-vue-application';
import ControlledListManagerTemplate from 'templates/views/components/plugins/controlled-list-manager.htm';

import { createRouter, createWebHistory } from 'vue-router';

const router = createRouter({
history: createWebHistory(),
routes,
});

ko.components.register('controlled-list-manager', {
viewModel: function() {
createVueApp(ControlledListManager).then((vueApp) => {
createVueApplication(ControlledListManager).then((vueApp) => {
vueApp.use(router);
vueApp.mount('#controlled-list-manager-mounting-point');
});
},
template: ControlledListManagerTemplate,
});
});
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
<script setup lang="ts">
import arches from "arches";
import { computed, provide, ref } from "vue";
import { provide, ref } from "vue";
import { useRouter } from "vue-router";

import ProgressSpinner from "primevue/progressspinner";
import Splitter from "primevue/splitter";
import SplitterPanel from "primevue/splitterpanel";
import ConfirmDialog from "primevue/confirmdialog";
import Toast from "primevue/toast";

import { LIGHT_GRAY } from "@/arches_references/theme.ts";
import {
displayedRowKey,
selectedLanguageKey,
} from "@/arches_references/constants.ts";
import { routeNames } from "@/arches_references/routes.ts";
import { dataIsList } from "@/arches_references/utils.ts";
import ControlledListSplash from "@/arches_references/components/misc/ControlledListSplash.vue";
import ItemEditor from "@/arches_references/components/editor/ItemEditor.vue";
import ListCharacteristics from "@/arches_references/components/editor/ListCharacteristics.vue";

import ListHeader from "@/arches_references/components/misc/ListHeader.vue";
import ListTree from "@/arches_references/components/tree/ListTree.vue";
import MainSplitter from "@/arches_references/components/MainSplitter.vue";

import type { Ref } from "vue";
import type { Language } from "@/arches/types";
import type { Selectable } from "@/arches_references/types";

const splash = "splash";
const router = useRouter();

const displayedRow: Ref<Selectable | null> = ref(null);
const setDisplayedRow = (val: Selectable | null) => {
displayedRow.value = val;
if (val === null) {
router.push({ name: routeNames.splash });
return;
}
if (typeof val.id === "number") {
return;
}
if (dataIsList(val)) {
router.push({ name: routeNames.list, params: { id: val.id } });
} else {
router.push({ name: routeNames.item, params: { id: val.id } });
}
};
// @ts-expect-error vue-tsc doesn't like arbitrary properties here
provide(displayedRowKey, { displayedRow, setDisplayedRow });
Expand All @@ -37,60 +47,40 @@ const selectedLanguage: Ref<Language> = ref(
) as Language,
);
provide(selectedLanguageKey, selectedLanguage);

const panel = computed(() => {
if (!displayedRow.value) {
return ControlledListSplash;
}
if (dataIsList(displayedRow.value)) {
return ListCharacteristics;
}
return ItemEditor;
});
</script>

<template>
<div class="list-editor-container">
<ListHeader />
<Splitter
:pt="{
root: { style: { height: '100%' } },
gutter: { style: { background: LIGHT_GRAY } },
gutterHandler: { style: { background: LIGHT_GRAY } },
}"
>
<SplitterPanel
:size="34"
:min-size="25"
:pt="{
root: {
style: { display: 'flex', flexDirection: 'column' },
},
}"
>
<Suspense>
<ListTree />
<template #fallback>
<ProgressSpinner />
</template>
</Suspense>
</SplitterPanel>
<SplitterPanel
:size="66"
:min-size="25"
:style="{
margin: '1rem 0rem 4rem 1rem',
overflowY: 'auto',
paddingRight: '4rem',
}"
>
<component
:is="panel"
:key="displayedRow?.id ?? splash"
/>
</SplitterPanel>
</Splitter>
<!-- Subtract size of arches toolbars -->
<div style="width: calc(100vw - 50px); height: calc(100vh - 50px)">
<div class="list-editor-container">
<ListHeader />
<MainSplitter />
</div>
</div>
<Toast />
<ConfirmDialog
:draggable="false"
:pt="{
root: {
style: {
fontSize: 'small',
},
},
header: {
style: {
background: 'var(--p-navigation)',
color: 'white',
borderRadius: '1rem',
marginBottom: '1rem',
},
},
title: {
style: {
fontWeight: 800,
},
},
}"
/>
</template>

<style scoped>
Expand All @@ -99,4 +89,16 @@ const panel = computed(() => {
flex-direction: column;
height: 100%;
}

:deep(h2) {
font-size: medium;
}

:deep(h3) {
font-size: medium;
}

:deep(h4) {
font-size: small;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<script setup lang="ts">
import { computed, inject } from "vue";

import ProgressSpinner from "primevue/progressspinner";
import Splitter from "primevue/splitter";
import SplitterPanel from "primevue/splitterpanel";

import { displayedRowKey } from "@/arches_references/constants.ts";
import { routeNames } from "@/arches_references/routes.ts";
import { dataIsList } from "@/arches_references/utils.ts";
import ControlledListSplash from "@/arches_references/components/misc/ControlledListSplash.vue";
import ItemEditor from "@/arches_references/components/editor/ItemEditor.vue";
import ListCharacteristics from "@/arches_references/components/editor/ListCharacteristics.vue";
import ListTree from "@/arches_references/components/tree/ListTree.vue";

import type { Ref } from "vue";
import type { ControlledList } from "@/arches_references/types";

const { displayedRow } = inject(displayedRowKey) as unknown as {
displayedRow: Ref<ControlledList>;
};

const panel = computed(() => {
if (!displayedRow.value) {
return ControlledListSplash;
}
if (dataIsList(displayedRow.value)) {
return ListCharacteristics;
}
return ItemEditor;
});
</script>

<template>
<Splitter style="height: 100%">
<SplitterPanel
:size="34"
:min-size="25"
style="display: flex; flex-direction: column"
>
<Suspense>
<ListTree />
<template #fallback>
<ProgressSpinner />
</template>
</Suspense>
</SplitterPanel>
<SplitterPanel
:size="66"
:min-size="25"
:style="{
margin: '1rem 0rem 4rem 1rem',
overflowY: 'auto',
paddingRight: '4rem',
}"
>
<component
:is="panel"
:key="displayedRow?.id ?? routeNames.splash"
/>
</SplitterPanel>
</Splitter>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import { useGettext } from "vue3-gettext";

import Button from "primevue/button";

import { ARCHES_CHROME_BLUE } from "@/arches_references/theme.ts";
import { itemKey } from "@/arches_references/constants.ts";
import { dataIsNew } from "@/arches_references/utils.ts";
import { itemKey, CONTRAST, PRIMARY } from "@/arches_references/constants.ts";
import { dataIsNew, shouldUseContrast } from "@/arches_references/utils.ts";

import type { Ref } from "vue";
import type {
Expand Down Expand Up @@ -67,34 +66,17 @@ const addMetadata = () => {
<Button
class="add-metadata"
raised
icon="fa fa-plus-circle"
:severity="shouldUseContrast() ? CONTRAST : PRIMARY"
:label="$gettext('Add metadata')"
@click="addMetadata"
>
<i
class="fa fa-plus-circle"
aria-hidden="true"
/>
<span class="add-metadata-text">
{{ $gettext("Add metadata") }}
</span>
</Button>
/>
</template>

<style scoped>
.add-metadata {
display: flex;
height: 3rem;
color: v-bind(ARCHES_CHROME_BLUE);
background-color: #f3fbfd;
margin-top: 1rem;
}
.add-metadata > i,
.add-metadata > span {
align-self: center;
font-size: small;
}
.add-metadata-text {
margin: 1rem;
font-size: small;
font-weight: 600;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import { useGettext } from "vue3-gettext";

import Button from "primevue/button";

import { ARCHES_CHROME_BLUE } from "@/arches_references/theme.ts";
import {
itemKey,
ALT_LABEL,
CONTRAST,
NOTE_CHOICES,
PREF_LABEL,
PRIMARY,
} from "@/arches_references/constants.ts";
import { dataIsNew } from "@/arches_references/utils.ts";
import { dataIsNew, shouldUseContrast } from "@/arches_references/utils.ts";

import type { Ref } from "vue";
import type { Language } from "@/arches/types";
Expand Down Expand Up @@ -98,33 +99,18 @@ const addValue = () => {
<Button
class="add-value"
raised
icon="fa fa-plus-circle"
:severity="shouldUseContrast() ? CONTRAST : PRIMARY"
:label="buttonLabel"
@click="addValue"
>
<i
class="fa fa-plus-circle"
aria-hidden="true"
/>
<span class="add-value-text">
{{ buttonLabel }}
</span>
</Button>
/>
</template>

<style scoped>
.add-value {
display: flex;
height: 3rem;
color: v-bind(ARCHES_CHROME_BLUE);
background-color: #f3fbfd;
margin-top: 1rem;
}
.add-value > i,
.add-value > span {
align-self: center;
}
.add-value-text {
margin: 1rem;
font-size: small;
font-weight: 600;
font-size: smaller;
}
</style>
Loading
Loading