-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6bb1df
commit ecced28
Showing
10 changed files
with
327 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<script setup lang="ts" generic="T"> | ||
defineProps<{ | ||
items?: T[], | ||
}>() | ||
const isOpen = ref(false) | ||
</script> | ||
|
||
<template> | ||
<details | ||
class="bc-accordion" | ||
@click="isOpen = !isOpen" | ||
> | ||
<summary> | ||
<span class="bc-accordion__heading"> | ||
<IconChevron | ||
:direction="isOpen ? 'bottom' : 'right'" | ||
/> | ||
<slot name="headingIcon" /> | ||
<slot name="heading" /> | ||
</span> | ||
</summary> | ||
<BcCard class="bc-accordion__content"> | ||
<ul class="bc-accordion-list"> | ||
<li | ||
v-for="item in items" | ||
:key="`${item}`" | ||
class="bc-accordion-list__item" | ||
> | ||
<slot name="item" :item /> | ||
</li> | ||
</ul> | ||
</BcCard> | ||
</details> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
// summary::marker { | ||
// display: none; | ||
// } | ||
.bc-accordion { | ||
summary { | ||
list-style: none | ||
} | ||
summary::-webkit-details-marker{ | ||
display: none; | ||
} | ||
} | ||
.bc-accordion__heading { | ||
display: inline-flex; | ||
align-items: center; | ||
gap: 0.625rem; | ||
} | ||
.bc-accordion__content { | ||
margin-top: 0.625rem; | ||
} | ||
.bc-accordion-list { | ||
list-style: none; | ||
} | ||
.bc-accordion-list__item { | ||
display: inline; | ||
} | ||
.bc-accordion-list__item:not(:last-child)::after { | ||
content: ', '; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script setup lang="ts"></script> | ||
|
||
<template> | ||
<div class="bc-card"> | ||
<slot /> | ||
<slot name="footer" /> | ||
<slot name="floating-action-button" /> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.bc-card { | ||
background-color: var(--input-background); | ||
border-radius: var(--corner-radius, 4px); | ||
padding: 0.625rem; | ||
border: 1px solid var(--input-border-color); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ defineProps<{ | |
<template> | ||
<NuxtLink | ||
:to | ||
class="link" | ||
:no-prefetch="true" | ||
> | ||
<template #default> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
frontend/components/notifications/NotificationsDashboardDialogEntity.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<script setup lang="ts"> | ||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' | ||
import { faGlobe } from '@fortawesome/pro-solid-svg-icons' | ||
import type { NotificationDashboardsTableRow } from '~/types/api/notifications' | ||
// const model = defineModel(false) | ||
const { t: $t } = useTranslation() | ||
const { | ||
// close, | ||
props, | ||
} = useBcDialog<{ identifier: string } & Pick<NotificationDashboardsTableRow, 'dashboard_id' | 'epoch' | 'group_id' | 'group_name'>>() | ||
const store = useNotificationsDashboardDetailsStore() | ||
const { data: details } = useAsyncData(() => store.getDetails({ | ||
// dashboard_id: props.value?.dashboard_id ?? 0, | ||
dashboard_id: 5334, // 💀 (personal dashboard id) remove after development | ||
epoch: props.value?.epoch ?? 0, | ||
group_id: props.value?.group_id ?? 0, | ||
})) | ||
watch(details, () => { | ||
// console.log(data) | ||
// store.addDetails({ | ||
// details: data.value, | ||
// identifier: props.value?.identifier ?? '', | ||
// }) | ||
}) | ||
const validatorsBackOnline = computed(() => { | ||
return details.value?.data?.validator_back_online | ||
}) | ||
const groupsBackOnline = computed(() => { | ||
return details.value?.data?.group_back_online | ||
}) | ||
</script> | ||
|
||
<template> | ||
<!-- <pre> | ||
{{ details.data }} | ||
</pre> --> | ||
<div class="notifications-dashboard-dialog-entity"> | ||
<header> | ||
<h2> | ||
<BcText | ||
variant="lg" | ||
> | ||
{{ $t('notifications.dashboards.dialog.entity.title') }} | ||
</BcText> | ||
<BcText | ||
variant="md" | ||
is-dimmed | ||
> | ||
({{ $t('common.epoch') }} {{ props?.epoch }}) | ||
</BcText> | ||
</h2> | ||
<h3> | ||
{{ props?.group_name }} | ||
</h3> | ||
</header> | ||
<main | ||
v-if="details?.data" | ||
class="notifications-dashboard-dialog-entity__content" | ||
> | ||
<!-- <details v-for="(detailValue, detailKey) in details.data" :key="detailKey"> | ||
<summary> | ||
{{ detailKey }} | ||
</summary> | ||
<p v-if="detailKey === 'validator_back_online'"> | ||
<span v-for="(value, index) in detailKey" :key="`${value}-${key}`"> | ||
{{ value }} | ||
<br> | ||
{{ key }} | ||
</span> | ||
</p> | ||
</details> --> | ||
<BcAccordion | ||
:items="groupsBackOnline" | ||
> | ||
<template #heading> | ||
{{ $t('notifications.dashboards.dialog.entity.group_back_online', [groupsBackOnline?.length ?? 0]) }} | ||
</template> | ||
<template #headingIcon> | ||
<FontAwesomeIcon :icon="faGlobe" /> | ||
</template> | ||
<template #item="{ item: group }"> | ||
<span> | ||
{{ group.group_name }} | ||
</span> | ||
<span> | ||
[{{ group.epoch_count }} {{ $t('common.epoch', group.epoch_count) }}] | ||
</span> | ||
<BcLink | ||
:to="`/dashboard/${group.dashboard_id}`" | ||
> | ||
<!-- Todo: 🚨 put in dashboard name here --> | ||
(Dashboard {{ group.dashboard_id }}) | ||
</BcLink> | ||
</template> | ||
</BcAccordion> | ||
<BcAccordion | ||
:items="validatorsBackOnline" | ||
> | ||
<template #heading> | ||
{{ $t('notifications.dashboards.dialog.entity.validator_back_online', [validatorsBackOnline?.length ?? 0]) }} | ||
</template> | ||
<template #item="{ item: validator }"> | ||
<BcLink | ||
:to="`/validator/{{ validator.index }}`" | ||
> | ||
{{ validator.index }} | ||
</BcLink> | ||
({{ validator.epoch_count }} {{ $t('common.epoch', validator.epoch_count) }})<!-- | ||
this will remove white space in html | ||
--> | ||
</template> | ||
</BcAccordion> | ||
</main> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.notifications-dashboard-dialog-entity { | ||
min-width: 44rem; | ||
} | ||
.notifications-dashboard-dialog-entity__content { | ||
margin-top: 1.25rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.