Files
thetool/public/mobile/components/MainMenu.js
2026-01-13 12:44:45 +01:00

67 lines
2.5 KiB
JavaScript

/**
* MainMenu Component
*
* Displays the main module menu for the MobileApp.
* Shows available modules like "Lager" that the user can access.
*/
export default {
name: 'MainMenu',
emits: ['navigate'],
props: {
user: Object
},
setup(props, { emit }) {
// Available modules
const modules = [
{
id: 'Lager',
name: 'Lager',
icon: 'warehouse',
color: 'bg-blue-500',
iconColor: 'text-blue-500'
}
// Future modules can be added here
];
const openModule = (moduleId) => {
emit('navigate', moduleId, null);
};
return {
modules,
openModule
};
},
template: `
<div class="p-3">
<!-- Module List -->
<div class="bg-white dark:bg-slate-800 rounded-xl overflow-hidden shadow-sm">
<button
v-for="(module, index) in modules"
:key="module.id"
@click="openModule(module.id)"
:class="[
'w-full flex items-center px-4 py-3.5 hover:bg-slate-50 dark:hover:bg-slate-700/50 active:bg-slate-100 dark:active:bg-slate-700 transition text-left',
index !== modules.length - 1 ? 'border-b border-slate-100 dark:border-slate-700' : ''
]"
>
<div :class="[module.color, 'w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0']">
<svg v-if="module.icon === 'warehouse'" xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 14v3m4-3v3m4-3v3M3 21h18M3 10h18M3 7l9-4 9 4M4 10h16v11H4V10z" />
</svg>
</div>
<span class="ml-3 font-medium text-slate-800 dark:text-white flex-1">
{{ module.name }}
</span>
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
</svg>
</button>
</div>
</div>
`
};