70 lines
3.5 KiB
Vue
70 lines
3.5 KiB
Vue
<template>
|
|
<div class="flex items-center gap-3">
|
|
<div v-if="isEditorActive" class="flex items-center gap-2 group">
|
|
<div class="text-right hidden lg:block">
|
|
<p class="text-[10px] uppercase tracking-wider font-bold text-gray-400 dark:text-gray-500 mb-[-2px]">Current Project</p>
|
|
<Tooltip text="Rename project">
|
|
<button @click="$emit('open-save-modal')" class="text-sm font-bold text-gray-800 dark:text-gray-200 hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors truncate max-w-[160px]">
|
|
{{ projectStore.currentProject?.name || 'Untitled project' }}
|
|
</button>
|
|
</Tooltip>
|
|
</div>
|
|
|
|
<!-- Mobile/Tablet simplified view -->
|
|
<button @click="$emit('open-save-modal')" class="lg:hidden text-sm font-bold text-gray-800 dark:text-gray-200 hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors truncate max-w-[120px]">
|
|
{{ projectStore.currentProject?.name || 'Untitled' }}
|
|
</button>
|
|
</div>
|
|
|
|
<div v-if="isEditorActive" class="h-8 w-px bg-gray-200 dark:bg-gray-700 mx-1"></div>
|
|
|
|
<div class="flex items-center gap-1">
|
|
<Tooltip v-if="isEditorActive" :text="isSaving ? 'Saving...' : 'Save project'">
|
|
<button @click="$emit('save-project')" class="w-8 h-8 rounded-lg flex items-center justify-center text-gray-500 hover:text-indigo-600 hover:bg-indigo-50 dark:hover:bg-indigo-900/30 transition-all" :disabled="isSaving">
|
|
<svg v-if="isSaving" class="animate-spin h-4 w-4 text-indigo-600 dark:text-indigo-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
</svg>
|
|
<i v-else class="fas fa-save"></i>
|
|
</button>
|
|
</Tooltip>
|
|
|
|
<Tooltip v-if="isEditorActive && projectStore.currentProject" text="Save as...">
|
|
<button @click="$emit('open-save-modal', 'save-as')" class="w-8 h-8 rounded-lg flex items-center justify-center text-gray-500 hover:text-indigo-600 hover:bg-indigo-50 dark:hover:bg-indigo-900/30 transition-all">
|
|
<i class="fas fa-clone"></i>
|
|
</button>
|
|
</Tooltip>
|
|
|
|
<Tooltip text="New project">
|
|
<button @click="$emit('open-new-project-modal')" class="w-8 h-8 rounded-lg flex items-center justify-center text-gray-500 hover:text-indigo-600 hover:bg-indigo-50 dark:hover:bg-indigo-900/30 transition-all">
|
|
<i class="fas fa-plus"></i>
|
|
</button>
|
|
</Tooltip>
|
|
|
|
<Tooltip text="My projects">
|
|
<button @click="$emit('open-project-list')" class="w-8 h-8 rounded-lg flex items-center justify-center text-gray-500 hover:text-indigo-600 hover:bg-indigo-50 dark:hover:bg-indigo-900/30 transition-all">
|
|
<i class="fas fa-folder-open"></i>
|
|
</button>
|
|
</Tooltip>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue';
|
|
import { useRoute } from 'vue-router';
|
|
import { useProjectStore } from '@/stores/useProjectStore';
|
|
import Tooltip from '@/components/utilities/Tooltip.vue';
|
|
|
|
defineEmits(['save-project', 'open-save-modal', 'open-project-list', 'open-new-project-modal']);
|
|
|
|
const route = useRoute();
|
|
const projectStore = useProjectStore();
|
|
|
|
defineProps<{
|
|
isSaving?: boolean;
|
|
}>();
|
|
|
|
const isEditorActive = computed(() => route.name === 'editor');
|
|
</script>
|