feat(KAN-19): add responsive permission-aware navigation
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { usePage } from '@inertiajs/vue3';
|
||||
import { computed } from 'vue';
|
||||
import { useLocalization } from '@/composables/useLocalization';
|
||||
import {
|
||||
projectNavigation,
|
||||
projectSettingsNavigation,
|
||||
workspaceNavigation,
|
||||
} from '@/lib/navigation';
|
||||
|
||||
export function useAppNavigation() {
|
||||
const page = usePage();
|
||||
const { t } = useLocalization();
|
||||
const project = computed(() => page.props.navigation?.project ?? null);
|
||||
|
||||
return {
|
||||
project,
|
||||
workspaceItems: computed(() =>
|
||||
workspaceNavigation(page.props.auth.permissions, t),
|
||||
),
|
||||
projectItems: computed(() => projectNavigation(project.value, t)),
|
||||
projectSettingsItems: computed(() =>
|
||||
projectSettingsNavigation(project.value, t),
|
||||
),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user