Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviareichl committed Oct 16, 2024
2 parents ccc091f + 941e942 commit 43ca285
Show file tree
Hide file tree
Showing 57 changed files with 3,999 additions and 621 deletions.
5 changes: 5 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ OAUTH_CLIENT_SECRET=
OAUTH_REDIRECT_URL="https://openatlas-discovery-demo.acdh-ch-dev.oeaw.ac.at/api/oauth/callback"
# Deployed website's base URL.
OAUTH_ALLOWED_ORIGIN="https://openatlas-discovery-demo.acdh-ch-dev.oeaw.ac.at"

# -------------------------------------------------------------------------------------------------
# alex watzinger's custom server setup
# -------------------------------------------------------------------------------------------------
NUXT_PUBLIC_SPECIAL_IMPRINT="disabled"
7 changes: 5 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
filters: |
src:
- '!content/**'
- '!(content|public)/**'
validate:
name: Validate
Expand Down Expand Up @@ -65,6 +65,7 @@ jobs:
run: pnpm install --frozen-lockfile
env:
NUXT_PUBLIC_API_BASE_URL: "${{ vars.NUXT_PUBLIC_API_BASE_URL }}"
NUXT_PUBLIC_DATABASE: "${{ vars.NUXT_PUBLIC_DATABASE }}"
NUXT_PUBLIC_OPENAPI_BASE_URL: "${{ vars.NUXT_PUBLIC_OPENAPI_BASE_URL }}"

- name: Format
Expand Down Expand Up @@ -103,6 +104,7 @@ jobs:
env:
NUXT_PUBLIC_API_BASE_URL: "${{ vars.NUXT_PUBLIC_API_BASE_URL }}"
NUXT_PUBLIC_APP_BASE_URL: "http://localhost:3000"
NUXT_PUBLIC_DATABASE: "${{ vars.NUXT_PUBLIC_DATABASE }}"
NUXT_PUBLIC_OPENAPI_BASE_URL: "${{ vars.NUXT_PUBLIC_OPENAPI_BASE_URL }}"
NUXT_PUBLIC_REDMINE_ID: "${{ vars.SERVICE_ID }}"

Expand All @@ -120,7 +122,8 @@ jobs:

build-deploy:
name: Build and deploy
if: ${{ always() && github.event_name == 'push' }}
# @see https://github.com/orgs/community/discussions/45058
if: ${{ github.event_name == 'push' && !failure() && !cancelled() }}
needs: [validate]
uses: ./.github/workflows/build-deploy.yml
secrets: inherit
Expand Down
7 changes: 0 additions & 7 deletions components/app-footer.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<script lang="ts" setup>
import { isNonEmptyString } from "@acdh-oeaw/lib";
import { HeartIcon } from "lucide-vue-next";
import type { NavLinkProps } from "@/components/nav-link.vue";
import { project } from "@/config/project.config";
const env = useRuntimeConfig();
const t = useTranslations();
const links = computed(() => {
Expand Down Expand Up @@ -44,11 +42,6 @@ const links = computed(() => {
</li>
</ul>
</nav>

<div class="sm:justify-self-end sm:text-right">
Version:
{{ [env.public.gitTag, env.public.gitBranchName].filter(isNonEmptyString).join(" - ") }}
</div>
</div>
</footer>
</template>
33 changes: 24 additions & 9 deletions components/app-header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,38 @@ import type { ContentPage } from "@/types/content";
const locale = useLocale();
const t = useTranslations();
const env = useRuntimeConfig();
const defaultLinks = computed<
// eslint-disable-next-line @typescript-eslint/ban-types
Record<"home" & (string & {}), { href: NavLinkProps["href"]; label: string }>
>(() => {
if (!project.map.startPage) {
if (env.public.database === "enabled" && !project.map.startPage) {
return {
home: { href: { path: "/" }, label: t("AppHeader.links.home") },
data: { href: { path: "/data" }, label: t("AppHeader.links.data") },
map: { href: { path: "/map" }, label: t("AppHeader.links.map") },
network: { href: { path: "/network" }, label: t("AppHeader.links.network") },
home: {
href: { path: "/" },
label: t("AppHeader.links.home"),
},
data: {
href: { path: "/visualization", query: { mode: "table" } },
label: t("AppHeader.links.data"),
},
map: {
href: { path: "/visualization", query: { mode: "map" } },
label: t("AppHeader.links.map"),
},
network: {
href: { path: "/visualization", query: { mode: "network" } },
label: t("AppHeader.links.network"),
},
team: { href: { path: "/team" }, label: t("AppHeader.links.team") },
};
}
return {
home: { href: { path: "/" }, label: t("AppHeader.links.home") },
data: { href: { path: "/data" }, label: t("AppHeader.links.data") },
network: { href: { path: "/network" }, label: t("AppHeader.links.network") },
home: {
href: project.map.startPage ? { path: "/", mode: "map" } : { path: "/" },
label: t("AppHeader.links.home"),
},
team: { href: { path: "/team" }, label: t("AppHeader.links.team") },
};
});
Expand Down Expand Up @@ -111,7 +126,7 @@ const links = computed(() => {

<div class="ml-auto flex items-center gap-4">
<ColorSchemeSwitcher />
<LocaleSwitcher v-if="locales.length > 0" />
<LocaleSwitcher v-if="locales.length > 1" />
<nav :aria-label="t('AppHeader.navigation-main')" class="flex shrink-0 lg:hidden">
<AppNavigationMobileMenu :title="t('AppHeader.navigation-menu')" :links="links" />
</nav>
Expand Down
22 changes: 20 additions & 2 deletions components/custom-primary-details-feature.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const t = useTranslations();
const { getUnprefixedId } = useIdPrefix();
const props = defineProps<{ entity: EntityFeature }>();
const route = useRoute();
const { data } = useGetBySystemClass(
computed(() => {
Expand Down Expand Up @@ -80,13 +81,27 @@ const handledRelations: Array<RelationType> = [
onMounted(() => {
emit("handledRelations", handledRelations);
});
function getPath() {
if (route.path.includes("visualization")) {
return "visualization";
}
return "";
}
const currentMode = computed(() => {
return route.query.mode;
});
</script>

<template>
<div class="flex justify-between">
<NavLink
v-if="previousFeature"
:href="{ path: `/entities/${getUnprefixedId(previousFeature['@id'])}` }"
:href="{
path: `/${getPath()}`,
query: { mode: currentMode, selection: getUnprefixedId(previousFeature['@id']) },
}"
class="flex items-center underline decoration-dotted transition hover:no-underline focus-visible:no-underline"
>
<ChevronLeftIcon class="size-4" />
Expand All @@ -95,7 +110,10 @@ onMounted(() => {
</NavLink>
<NavLink
v-if="nextFeature"
:href="{ path: `/entities/${getUnprefixedId(nextFeature['@id'])}` }"
:href="{
path: `/${getPath()}`,
query: { mode: currentMode, selection: getUnprefixedId(nextFeature['@id']) },
}"
class="flex items-center underline decoration-dotted transition hover:no-underline focus-visible:no-underline"
>
<span>{{ nextFeature.properties.title }}</span>
Expand Down
7 changes: 3 additions & 4 deletions components/data-graph.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<script setup lang="ts">
import Graph from "graphology";
import { networkConfig } from "@/config/network-visualisation.config";
import type { NetworkEntity } from "@/types/api";
import { colors } from "../project.config.json";
const props = defineProps<{
networkData: NetworkEntity;
searchNode: string;
Expand All @@ -13,8 +12,8 @@ const props = defineProps<{
const graph = new Graph();
const { entityColors } = colors;
const defaultColor = colors.entityDefaultColor;
const { entityColors } = networkConfig.colors;
const defaultColor = networkConfig.colors.entityDefaultColor;
watch(
() => {
Expand Down
99 changes: 65 additions & 34 deletions components/data-map-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,62 @@ const router = useRouter();
const route = useRoute();
const t = useTranslations();
const currentView = useGetCurrentView();
const { getUnprefixedId } = useIdPrefix();
const searchFiltersSchema = v.object({
category: v.fallback(v.picklist(categories), "entityName"),
search: v.fallback(v.string(), ""),
});
const detailEntityId = computed(() => {
return route.params.id as string;
const idCategories = ["entityID", "typeID", "valueTypeID", "typeIDWithSubs"];
const entitySelectionSchema = v.object({
selection: v.fallback(v.array(v.string()), []),
});
const searchFilters = computed(() => {
return v.parse(searchFiltersSchema, route.query);
});
type EntitySelection = v.InferOutput<typeof entitySelectionSchema>;
type SearchFilters = v.InferOutput<typeof searchFiltersSchema>;
function setEntitySelection(query: Partial<EntitySelection>) {
void router.push({ query: { mode: route.query.mode, ...query } });
}
function onChangeEntitySelection(values: EntityFeature) {
const temp: EntitySelection = {
selection: [getUnprefixedId(values["@id"])],
};
setEntitySelection(temp);
}
function setSearchFilters(query: Partial<SearchFilters>) {
void router.push({ query });
void router.push({ query: { mode: route.query.mode, ...query } });
}
function onChangeSearchFilters(values: SearchFormData) {
setSearchFilters(values);
}
const { data, isPending, isPlaceholderData } = useGetSearchResults(
// @ts-expect-error Includes custom, per-instance system classes.
computed(() => {
const { search, category, ...params } = searchFilters.value;
const operator = idCategories.includes(category) ? "equal" : "like";
return {
...params,
search:
search.length > 0
? [{ [category]: [{ operator: "like", values: [search], logicalOperator: "and" }] }]
? [{ [category]: [{ operator: operator, values: [search], logicalOperator: "and" }] }]
: [],
show: ["geometry", "when"],
centroid: true,
system_classes: ["place"],
system_classes: project.map.mapDisplayedSystemClasses,
limit: 0,
};
}),
Expand Down Expand Up @@ -83,6 +100,13 @@ function togglePolygons() {
show.value = !show.value;
}
const selection = computed(() => {
return route.query.selection;
});
const mode = computed(() => {
return route.query.mode;
});
/**
* Reduce size of geojson payload, which has an impact on performance,
* because `maplibre-gl` will serialize geojson features when sending them to the webworker.
Expand Down Expand Up @@ -148,44 +172,50 @@ watch(data, () => {
});
watchEffect(() => {
const entity = entities.value.find((feature) => {
const id = getUnprefixedId(feature["@id"]);
return id === detailEntityId.value;
});
if (entity) {
let coordinates = null;
if (entity.geometry.type === "GeometryCollection") {
coordinates = entity.geometry.geometries.find((g) => {
return g.type === "Point";
})?.coordinates as [number, number] | undefined;
if (mode.value && selection.value) {
const entity = entities.value.find((feature) => {
const id = getUnprefixedId(feature["@id"]);
return id === selection.value;
});
if (entity) {
let coordinates = null;
if (entity.geometry.type === "GeometryCollection") {
coordinates = entity.geometry.geometries.find((g) => {
return g.type === "Point";
})?.coordinates as [number, number] | undefined;
}
if (entity.geometry.type === "Point") {
coordinates = entity.geometry.coordinates as unknown as [number, number];
}
popover.value = {
coordinates:
coordinates ??
(turf.center(createFeatureCollection([entity])).geometry.coordinates as [number, number]),
entities: [entity],
};
}
if (entity.geometry.type === "Point") {
coordinates = entity.geometry.coordinates as unknown as [number, number];
}
popover.value = {
coordinates:
coordinates ??
(turf.center(createFeatureCollection([entity])).geometry.coordinates as [number, number]),
entities: [entity],
};
}
});
</script>

<template>
<div :class="project.fullscreen ? 'relative grid' : 'relative grid grid-rows-[auto_1fr] gap-4'">
<div :class="project.fullscreen ? 'absolute z-10 flex w-full justify-center' : ''">
<div
:class="
project.fullscreen ? 'absolute z-10 flex w-full justify-center pointer-events-none' : ''
"
>
<SearchForm
:class="
project.fullscreen
? 'bg-white/90 dark:bg-neutral-900 max-w-[800px] w-full mt-2 rounded-md p-6 shadow-md'
? 'bg-white/90 dark:bg-neutral-900 max-w-[800px] w-full mt-2 rounded-md p-6 shadow-md pointer-events-auto'
: ''
"
:filter="searchFilters.category"
:category="searchFilters.category"
:search="searchFilters.search"
@submit="onChangeSearchFilters"
/>
Expand Down Expand Up @@ -244,8 +274,9 @@ watchEffect(() => {
>
<strong class="font-medium">
<NavLink
class="flex items-center gap-1 underline decoration-dotted hover:no-underline"
:href="{ path: `/entities/${entity.properties._id}/${currentView}` }"
href="#"
class="flex cursor-pointer items-center gap-1 underline decoration-dotted hover:no-underline"
@click="onChangeEntitySelection(entity)"
>
<Component :is="getEntityIcon(entity.systemClass)" class="size-3.5 shrink-0" />
{{ entity.properties.title }}
Expand Down
Loading

0 comments on commit 43ca285

Please sign in to comment.