26 lines
777 B
TypeScript
26 lines
777 B
TypeScript
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),
|
|
),
|
|
};
|
|
}
|