Skip to content

Commit

Permalink
fix: link to detail views and replace checkboxes with dots
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviareichl committed May 15, 2024
1 parent 8616aba commit 08a5f3c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
15 changes: 8 additions & 7 deletions components/data-network-view.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts" setup>
import { z } from "zod";
import type { SearchFormData } from "@/components/search-form.vue";
import type { SearchFormData as CategoryFormData } from "@/components/network-legend-panel.vue";
import type { SearchFormData } from "@/components/network-search-form.vue";
const router = useRouter();
const route = useRoute();
Expand All @@ -17,12 +18,12 @@ const searchFilters = computed(() => {
type SearchFilters = z.infer<typeof searchFiltersSchema>;
function setSearchFilters(query: Partial<SearchFilters>) {
void router.push({ query });
function onChangeSearchFilters(values: SearchFormData) {
void router.push({ query: { ...searchFilters.value, ...values } });
}
function onChangeSearchFilters(values: SearchFormData) {
setSearchFilters(values);
function onChangeCategory(values: CategoryFormData) {
void router.push({ query: { ...searchFilters.value, ...values } });
}
const { data, error, isPending, isPlaceholderData, suspense } = useGetNetworkData(
Expand All @@ -39,6 +40,7 @@ const { data, error, isPending, isPlaceholderData, suspense } = useGetNetworkDat
"external_reference",
"administrative_unit",
"edition",
"type_tools",
],
};
}),
Expand Down Expand Up @@ -67,7 +69,6 @@ const systemClasses = computed(() => {
return systemClasses;
});
</script>

<template>
Expand All @@ -82,7 +83,7 @@ const systemClasses = computed(() => {
<NetworkLegendPanel
class="absolute bottom-0 right-0 z-10 m-3"
:system-classes="systemClasses"
@submit="onChangeSearchFilters"
@submit="onChangeCategory"
></NetworkLegendPanel>
<DataGraph :network-data="entities" :search-node="searchFilters.search" />
<Centered v-if="isLoading" class="pointer-events-none">
Expand Down
2 changes: 1 addition & 1 deletion components/entity-data-graph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ function getNodeColor(nodeClass: string) {
</span>
</Card>
</div>
<Network v-if="graph !== undefined" :graph="graph"></Network>
<Network v-if="graph !== undefined" :graph="graph" search-node=""></Network>
</template>
16 changes: 11 additions & 5 deletions components/network-legend-panel.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<script setup lang="ts">
import { DotIcon } from "lucide-vue-next";
import { colors } from "../project.config.json";
export interface SearchFormData {
category: string;
category: string; // TODO: stricter typings
}
const props = defineProps<{
Expand All @@ -15,7 +17,7 @@ const emit = defineEmits<{
function onSubmit(element: string) {
emit("submit", {
category: element,
category: element, //Array, checkbox-group html + how do i get teh values in the submit event handler
});
}
Expand Down Expand Up @@ -56,14 +58,18 @@ const systemClassColors = colors.entityColors;
:style="`color: ${systemClassColors[el] ? systemClassColors[el] : '#666'}`"
>
<div class="grid grid-cols-[auto_1fr] gap-2">
<input
<!-- <input
:id="el"
type="checkbox"
name="systemClassCheckbox"
:style="`accent-color: ${systemClassColors[el] ? systemClassColors[el] : '#666'}`"
checked
@submit="onSubmit(el)"
/>
@change="onSubmit(el)"
/> -->
<span
class="m-1.5 size-2 rounded-full"
:style="`background-color: ${systemClassColors[el] ? systemClassColors[el] : '#666'}`"
></span>
<span v-if="labels[el]">{{ labels[el] }}</span>
<span v-else> {{ el }}</span>
</div>
Expand Down
1 change: 1 addition & 0 deletions components/network.client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ watch(
skipIndexation: true,
});
},
{ immediate: true },
);
onMounted(async () => {
Expand Down

0 comments on commit 08a5f3c

Please sign in to comment.