Skip to content

Commit

Permalink
feat: added nav button with automation
Browse files Browse the repository at this point in the history
  • Loading branch information
srijitcoder committed Dec 2, 2024
1 parent 9c644ea commit 5f110cd
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 8 deletions.
27 changes: 26 additions & 1 deletion src/components/global/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const navPaginationItems = inject("set-nav-pagination-items");

<v-col class="button-nav flex-grow-0">
<v-btn
v-if="navButtonConfig.text"
v-if="navButtonConfig.text && navButtonConfig.click"
size="large"
:prepend-icon="navButtonConfig.icon"
variant="flat"
Expand All @@ -44,6 +44,31 @@ const navPaginationItems = inject("set-nav-pagination-items");
@click="navButtonConfig.click"
>{{ navButtonConfig.text }}</v-btn
>
<v-menu
location="bottom"
v-if="navButtonConfig.text && navButtonConfig.list"
>
<template v-slot:activator="{ props }">
<v-btn
size="large"
:prepend-icon="navButtonConfig.icon"
variant="flat"
class="text-capitalize font-weight-medium"
color="btn-primary"
v-bind="props"
>{{ navButtonConfig.text }}</v-btn
>
</template>
<v-list>
<v-list-item
v-for="(item, index) in navButtonConfig.list"
:prepend-icon="item.icon"
:title="item.title"
:key="index"
@click="item.click"
></v-list-item>
</v-list>
</v-menu>
</v-col>
</v-app-bar>
</template>
Expand Down
18 changes: 11 additions & 7 deletions src/views/SessionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,27 @@ const updateDetails = async (cache = false) => {
};
onMounted(async () => {
navButtonConfig.value = {
text: "Add/Edit File",
icon: "mdi-pencil-plus",
click: () => addNewFileClick(true),
};
suggestionList.value = [
...AUTOMATION,
{
title: "Add File Manually",
title: "Add/Edit File Manually",
description:
"Create a file by entering the file path and details manually.",
icon: "mdi-plus",
func: () => addNewFileClick(true),
},
];
navButtonConfig.value = {
text: "Add/Edit File",
icon: "mdi-pencil-plus",
list: suggestionList.value.map((suggestion) => ({
...suggestion,
click: () => suggestion.func?.() || handleAutomationClick(suggestion),
icon: suggestion.icon || "mdi-auto-fix",
})),
};
await updateDetails();
});
Expand Down

0 comments on commit 5f110cd

Please sign in to comment.