Skip to content
Snippets Groups Projects
Commit fdbf6b59 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

fix some ux

parent e175ffb0
No related branches found
No related tags found
No related merge requests found
Pipeline #112839 passed
<template> <template>
<v-footer app border text-center d-flex flex-column> <v-footer app border text-center d-flex flex-column>
<div class="px-4 py-1 text-center w-100"> <div class="px-4 text-center w-100">
<span><a href="https://mdmlab.fr/" target="_blank"><v-img src="/cropped-logoblue-288x129.png" inline :width="80" <span><a href="https://mdmlab.fr/" target="_blank"><v-img src="/cropped-logoblue-288x129.png" inline :width="70"
:aspect-ratio="288 / 129"></v-img></a></span> :aspect-ratio="288 / 129"></v-img></a></span>
</div> </div>
</v-footer> </v-footer>
......
<!-- from https://github.com/vuetifyjs/vuetify/blob/master/packages/docs/src/components/app/BackToTop.vue --> <!-- from https://github.com/vuetifyjs/vuetify/blob/master/packages/docs/src/components/app/BackToTop.vue -->
<template> <template>
<v-layout-item <v-layout-item v-scroll="onScroll" class="text-end pointer-events-none" model-value position="bottom"
v-scroll="onScroll" :size="model ? 88 : 0">
class="text-end pointer-events-none" <div class="ma-4">
model-value <v-fab-transition>
position="bottom" <v-btn v-show="model" class="mt-auto pointer-events-initial" color="primary" elevation="8" icon="mdi-chevron-up"
size="88" size="large" @click="onClick" />
> </v-fab-transition>
<div class="ma-4"> </div>
<v-fab-transition> </v-layout-item>
<v-btn </template>
v-show="model"
class="mt-auto pointer-events-initial"
color="primary"
elevation="8"
icon="mdi-chevron-up"
size="large"
@click="onClick"
/>
</v-fab-transition>
</div>
</v-layout-item>
</template>
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
const model = ref(false) const model = ref(false)
function onScroll () { function onScroll() {
model.value = window.scrollY > 200 model.value = window.scrollY > 200
} }
function onClick () { function onClick() {
window.scrollTo({ window.scrollTo({
top: 0, top: 0,
behavior: 'smooth', behavior: 'smooth',
}) })
} }
</script> </script>
<style scoped>
.pointer-events-none {
pointer-events: none;
}
.pointer-events-initial { <style scoped>
pointer-events: initial; .pointer-events-none {
} pointer-events: none;
</style> }
.pointer-events-initial {
pointer-events: initial;
}
</style>
\ No newline at end of file
...@@ -3,7 +3,7 @@ const { surround } = useContent(); ...@@ -3,7 +3,7 @@ const { surround } = useContent();
</script> </script>
<template> <template>
<v-row justify="space-between"> <v-row justify="space-between" class="mt-0">
<v-col v-for="(surroundPage, i) in surround" :key="surroundPage?._id" :cols="mobile ? '12' : 'auto'"> <v-col v-for="(surroundPage, i) in surround" :key="surroundPage?._id" :cols="mobile ? '12' : 'auto'">
<v-btn v-if="surroundPage" :prepend-icon="i === 0 ? 'mdi-arrow-left' : undefined" <v-btn v-if="surroundPage" :prepend-icon="i === 0 ? 'mdi-arrow-left' : undefined"
:append-icon="i === 1 ? 'mdi-arrow-right' : undefined" :block="mobile ? true : false" variant="outlined" :append-icon="i === 1 ? 'mdi-arrow-right' : undefined" :block="mobile ? true : false" variant="outlined"
......
...@@ -37,14 +37,14 @@ const { initPfam } = usePfamStore(); ...@@ -37,14 +37,14 @@ const { initPfam } = usePfamStore();
initPfam(); initPfam();
</script> </script>
<template> <template>
<v-card variant="outlined" class="my-5"> <v-card>
<v-toolbar color="primary"> <v-toolbar density="compact">
<v-toolbar-title>Defense Systems</v-toolbar-title> <v-toolbar-title>Defense Systems</v-toolbar-title>
<v-text-field v-model="search" density="compact" variant="underlined" prepend-inner-icon="mdi-magnify" <v-text-field v-model="search" density="compact" variant="underlined" prepend-inner-icon="mdi-magnify"
label="Search for defense systems" single-line hide-details class="mx-2" clearable></v-text-field> label="Search for defense systems" single-line hide-details class="mx-2" clearable></v-text-field>
</v-toolbar> </v-toolbar>
<v-data-table-virtual :height="height" :items-per-page="itemsPerParge" v-model:sort-by="sortBy" <v-data-table-virtual fixed-header :height="height" :items-per-page="itemsPerParge" v-model:sort-by="sortBy"
:headers="props.headers" density="compact" :custom-filter="filterOnlyCapsText" :items="props.systems" :headers="props.headers" density="compact" :custom-filter="filterOnlyCapsText" :items="props.systems"
:search="search" item-value="system.name"> :search="search" item-value="system.name">
<template #[`item.system`]="{ item }"> <template #[`item.system`]="{ item }">
......
...@@ -53,6 +53,6 @@ const systems = computed(() => { ...@@ -53,6 +53,6 @@ const systems = computed(() => {
</script> </script>
<template> <template>
<v-card flat color="transparent"> <v-card flat color="transparent">
<ListSystems :headers="headers" :systems="systems" :height="height - 405"></ListSystems> <ListSystems :headers="headers" :systems="systems" :height="height - 350"></ListSystems>
</v-card> </v-card>
</template> </template>
\ No newline at end of file
...@@ -3,7 +3,11 @@ import * as Plot from "@observablehq/plot"; ...@@ -3,7 +3,11 @@ import * as Plot from "@observablehq/plot";
import PlotFigure from "~/components/PlotFigure"; import PlotFigure from "~/components/PlotFigure";
import { useDisplay } from "vuetify"; import { useDisplay } from "vuetify";
const { width, lgAndDown } = useDisplay(); const { width, height } = useDisplay();
const computedTableHeight = computed(() => {
return height.value - 350
})
const drawer = ref(true); const drawer = ref(true);
// const { data } = await useAsyncData("refseq", () => // const { data } = await useAsyncData("refseq", () =>
...@@ -21,7 +25,7 @@ const { ...@@ -21,7 +25,7 @@ const {
); );
const availableTaxo = ref(["species", "genus", "phylum"]); const availableTaxo = ref(["species", "genus", "phylum"]);
const selectedTaxoRank = ref("phylum"); const selectedTaxoRank = ref("genus");
const sanitizedRefseq = computed(() => { const sanitizedRefseq = computed(() => {
if (refseqData.value?.body) { if (refseqData.value?.body) {
return refseqData.value.body; return refseqData.value.body;
...@@ -34,8 +38,8 @@ const computedWidth = computed(() => { ...@@ -34,8 +38,8 @@ const computedWidth = computed(() => {
return Math.max(width.value, 550); return Math.max(width.value, 550);
}); });
const height = computed(() => { const plotHeight = computed(() => {
return computedWidth.value / 3; return computedWidth.value / 4;
}); });
const search = ref(""); const search = ref("");
...@@ -90,24 +94,25 @@ const computedDistriSystemOptions = computed(() => { ...@@ -90,24 +94,25 @@ const computedDistriSystemOptions = computed(() => {
: { : {
x: "type", x: "type",
tip: true, tip: true,
fill: "#6750a4",
// fill: selectedTaxoRank.value, // fill: selectedTaxoRank.value,
sort: { x: "-y" }, sort: { x: "-y" },
}; };
return { return {
marginLeft: facetDistriSystem.value ? 120 : 30, marginLeft: 30,
marginBottom: facetDistriSystem.value ? 120 : 120, marginBottom: 120,
x: { label: null, tickRotate: 70 }, x: { label: null, tickRotate: 70 },
y: { grid: true }, y: { grid: true },
color: { legend: true }, color: { legend: true },
width: computedWidth.value, width: computedWidth.value,
height: facetDistriSystem.value ? height.value * 8 : height.value * 2, height: plotHeight.value,
marks: [ marks: [
Plot.frame(), // Plot.frame(),
Plot.barY( Plot.barY(
unref(selectedRefSeq.value), unref(selectedRefSeq.value),
Plot.groupX( Plot.groupX(
{ y: facetDistriSystem.value ? "proportion-facet" : "count" }, { y: "count" },
groupYOption groupYOption
) )
), ),
...@@ -116,43 +121,31 @@ const computedDistriSystemOptions = computed(() => { ...@@ -116,43 +121,31 @@ const computedDistriSystemOptions = computed(() => {
}); });
const computedDistriTaxoOptions = computed(() => { const computedDistriTaxoOptions = computed(() => {
const groupYOption = facet.value const groupYOption = {
? { x: selectedTaxoRank.value,
y: "type", // fx: selectedTaxoRank.value,
fy: selectedTaxoRank.value, tip: true,
fill: "type", // fill: "type",
tip: true, fill: "#6750a4",
sort: { x: "-y" }, // offset: "normalize",
} sort: { x: "-y" },
: { };
y: selectedTaxoRank.value,
tip: true,
fill: "type",
// offset: "normalize",
sort: { y: "x", reverse: true },
};
return { return {
// style: { // marginLeft: 110,
// width: "100%",
// "max-width": "100%",
// },
marginLeft: 110,
marginRight: facet.value ? 110 : 20,
marginBottom: 100, marginBottom: 100,
grid: true, grid: true,
x: { percent: true }, // x: { percent: true },
// x: { label: facet.value ? "Count" : null, tickRotate: 90 }, // x: { label: facet.value ? "Count" : null, tickRotate: 90 },
// y: { nice: true }, // y: { nice: true },
color: { legend: true }, color: { legend: true },
width: computedWidth.value, width: computedWidth.value,
height: facet.value ? height.value * 4.3 : height.value, height: plotHeight.value,
marks: [ marks: [
Plot.frame(), // Plot.frame(),
Plot.barX( Plot.barY(
unref(selectedRefSeq.value), unref(selectedRefSeq.value),
Plot.groupY({ x: "count" }, groupYOption) Plot.groupX({ y: "proportion" }, groupYOption)
), ),
], ],
}; };
...@@ -161,11 +154,12 @@ const computedDistriTaxoOptions = computed(() => { ...@@ -161,11 +154,12 @@ const computedDistriTaxoOptions = computed(() => {
<template> <template>
<v-card> <v-card>
<v-toolbar color="primary"><v-toolbar-title> REFSEQ</v-toolbar-title> <v-toolbar density="compact"><v-toolbar-title> REFSEQ</v-toolbar-title>
<v-text-field v-model="search" density="compact" variant="underlined" prepend-inner-icon="mdi-magnify" <v-text-field v-model="search" density="compact" variant="underlined" prepend-inner-icon="mdi-magnify"
label="Search for defense systems" single-line hide-details class="mx-2" clearable></v-text-field></v-toolbar> label="Search for defense systems" single-line hide-details class="mx-2" clearable></v-text-field></v-toolbar>
<v-data-table-virtual v-model="selected" :headers="headers" :items="sanitizedRefseq" :item-value="itemValue" <v-data-table-virtual fixed-header v-model="selected" :headers="headers" :items="sanitizedRefseq"
density="compact" :search="search" :custom-filter="filterOnlyCapsText" height="800" show-select class="elevation-1"> :item-value="itemValue" density="compact" :search="search" :custom-filter="filterOnlyCapsText"
:height="computedTableHeight" show-select class="elevation-1">
<template #[`item.type`]="{ item }"> <template #[`item.type`]="{ item }">
<v-chip variant="text" link :to="`/defense-systems/${item.type.toLowerCase()}`">{{ <v-chip variant="text" link :to="`/defense-systems/${item.type.toLowerCase()}`">{{
...@@ -175,13 +169,13 @@ const computedDistriTaxoOptions = computed(() => { ...@@ -175,13 +169,13 @@ const computedDistriTaxoOptions = computed(() => {
</v-data-table-virtual> </v-data-table-virtual>
</v-card> </v-card>
<v-card class="my-3"> <v-card class="my-3">
<v-toolbar color="primary"><v-toolbar-title> Distribution Systems</v-toolbar-title></v-toolbar> <v-toolbar density="compact"><v-toolbar-title> Distribution Systems</v-toolbar-title></v-toolbar>
<v-card-text> <v-card-text>
<PlotFigure :options="unref(computedDistriSystemOptions)" defer></PlotFigure> <PlotFigure :options="unref(computedDistriSystemOptions)" defer></PlotFigure>
</v-card-text> </v-card-text>
</v-card> </v-card>
<v-card> <v-card>
<v-toolbar color="primary"><v-toolbar-title> Distribution </v-toolbar-title></v-toolbar> <v-toolbar color="primary" density="compact"><v-toolbar-title> Distribution </v-toolbar-title></v-toolbar>
<v-card-text> <v-card-text>
<v-select v-model="selectedTaxoRank" :items="availableTaxo" density="compact" <v-select v-model="selectedTaxoRank" :items="availableTaxo" density="compact"
label="Select taxonomic rank"></v-select> label="Select taxonomic rank"></v-select>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment