-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(journals): Fixed journal profile context change
- Loading branch information
Showing
5 changed files
with
79 additions
and
59 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
18 changes: 15 additions & 3 deletions
18
packages/core/web/src/profiles/stores/profile-relation-infos.store.ts
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
58 changes: 58 additions & 0 deletions
58
packages/features/journals/web/src/components/calendar-plan/JournalCalendarPlan.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,58 @@ | ||
<script setup lang="ts"> | ||
import { LyAlert, LyContentPanel, LyFloatingAddButton, LyIcon } from '@lyvely/ui'; | ||
import JournalCalendarPlanSection from '@/components/calendar-plan/JournalCalendarPlanSection.vue'; | ||
import { useJournalPermissions } from '@lyvely/journals-interface'; | ||
import { t, useProfilePermissions } from '@lyvely/web'; | ||
import { useJournalPlanStore } from '@/stores'; | ||
import { onBeforeMount, onUnmounted, ref } from 'vue'; | ||
import { CalendarPlanFilterNavigation, CalendarPlanner } from '@lyvely/calendar-plan-web'; | ||
const journalStore = useJournalPlanStore(); | ||
const { intervals, filter, createItem, reset } = journalStore; | ||
const { isEmpty } = journalStore; | ||
const loaded = ref(false); | ||
const { isAllowed: canCreateJournal } = useProfilePermissions(useJournalPermissions().Create); | ||
const createJournal = () => { | ||
if (!canCreateJournal.value) return; | ||
createItem(); | ||
}; | ||
onBeforeMount(() => journalStore.loadModels().then(() => (loaded.value = true))); | ||
const unwatch = journalStore.startWatch(); | ||
onUnmounted(() => { | ||
unwatch(); | ||
reset(); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<calendar-plan-filter-navigation :filter="filter" /> | ||
<calendar-planner v-if="!isEmpty()"> | ||
<journal-calendar-plan-section | ||
v-for="interval in intervals" | ||
:key="interval" | ||
:interval="interval" /> | ||
</calendar-planner> | ||
<ly-content-panel v-else-if="loaded"> | ||
<ly-alert | ||
:class="[{ 'cursor-pointer': canCreateJournal }, 'justify-center bg-main']" | ||
:role="canCreateJournal ? 'button' : ''" | ||
@click="createJournal"> | ||
<div class="flex flex-col items-center justify-center"> | ||
<ly-icon name="journal" class="w-20 text-gray-300 dark:text-gray-500" /> | ||
<span v-if="canCreateJournal" class="font-semibold">{{ | ||
t('journals.calendar-plan.empty-create') | ||
}}</span> | ||
<span v-else class="font-semibold">{{ t('journals.calendar-plan.empty') }}</span> | ||
</div> | ||
</ly-alert> | ||
</ly-content-panel> | ||
|
||
<ly-floating-add-button v-if="canCreateJournal" @click="createItem" /> | ||
</template> | ||
|
||
<style scoped></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