Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
ssiyad committed Nov 17, 2023
1 parent 07db465 commit 904ebd6
Show file tree
Hide file tree
Showing 12 changed files with 318 additions and 293 deletions.
188 changes: 92 additions & 96 deletions desk/src/components/AppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'max-width': width,
}"
>
<UserMenu class="mb-2 ml-0.5" :options="profileSettings" />
<!-- <UserMenu class="mb-2 ml-0.5" :options="profileSettings" /> -->
<SidebarLink
label="Search"
class="mb-1"
Expand All @@ -21,30 +21,30 @@
</span>
</template>
</SidebarLink>
<span class="mb-4">
<div
v-if="notificationStore.unread"
class="absolute z-20 h-1.5 w-1.5 translate-x-6 translate-y-1 rounded-full bg-gray-800"
theme="gray"
variant="solid"
/>
<SidebarLink
class="relative"
label="Notifications"
:icon="LucideInbox"
:on-click="() => notificationStore.toggle()"
:is-expanded="isExpanded"
>
<template #right>
<Badge
v-if="isExpanded && notificationStore.unread"
:label="notificationStore.unread"
theme="gray"
variant="subtle"
/>
</template>
</SidebarLink>
</span>
<!-- <span class="mb-1"> -->
<!-- <div -->
<!-- v-if="notificationStore.unread" -->
<!-- class="absolute z-20 h-1.5 w-1.5 translate-x-6 translate-y-1 rounded-full bg-gray-800" -->
<!-- theme="gray" -->
<!-- variant="solid" -->
<!-- /> -->
<!-- <SidebarLink -->
<!-- class="relative" -->
<!-- label="Notifications" -->
<!-- :icon="LucideInbox" -->
<!-- :on-click="() => notificationStore.toggle()" -->
<!-- :is-expanded="isExpanded" -->
<!-- > -->
<!-- <template #right> -->
<!-- <Badge -->
<!-- v-if="isExpanded && notificationStore.unread" -->
<!-- :label="notificationStore.unread" -->
<!-- theme="gray" -->
<!-- variant="subtle" -->
<!-- /> -->
<!-- </template> -->
<!-- </SidebarLink> -->
<!-- </span> -->
<div class="mb-4 flex flex-col gap-1">
<SidebarLink
v-for="option in menuOptions"
Expand All @@ -54,15 +54,6 @@
:is-active="option.to?.includes(route.name.toString())"
/>
</div>
<div class="flex flex-col gap-1">
<SidebarLink
v-for="option in extraOptions.filter((o) => !o.hide)"
v-bind="option"
:key="option.label"
:is-expanded="isExpanded"
:is-active="option.to?.includes(route.name?.toString())"
/>
</div>
<div class="grow" />
<SidebarLink
:icon="isExpanded ? LucideArrowLeftFromLine : LucideArrowRightFromLine"
Expand All @@ -80,7 +71,7 @@ import { useRoute } from 'vue-router';
import { storeToRefs } from 'pinia';
import { useAuthStore } from '@/stores/auth';
import { useKeymapStore } from '@/stores/keymap';
import { useNotificationStore } from '@/stores/notification';
// import { useNotificationStore } from '@/stores/notification';
import { useSidebarStore } from '@/stores/sidebar';
import {
AGENT_PORTAL_AGENT_LIST,
Expand All @@ -96,7 +87,7 @@ import {
} from '@/router';
import { useDevice } from '@/composables';
import { SidebarLink } from '@/components';
import UserMenu from './UserMenu.vue';
// import UserMenu from './UserMenu.vue';
import LucideArrowLeftFromLine from '~icons/lucide/arrow-left-from-line';
import LucideArrowRightFromLine from '~icons/lucide/arrow-right-from-line';
import LucideArrowUpFromLine from '~icons/lucide/arrow-up-from-line';
Expand All @@ -115,69 +106,74 @@ import LucideUsers from '~icons/lucide/users';
const route = useRoute();
const authStore = useAuthStore();
const keymapStore = useKeymapStore();
const notificationStore = useNotificationStore();
// const notificationStore = useNotificationStore();
const { isExpanded, width } = storeToRefs(useSidebarStore());
const device = useDevice();
const menuOptions = computed(() => [
{
label: 'Tickets',
icon: LucideTicket,
to: AGENT_PORTAL_TICKET_LIST,
},
{
label: 'Dashboard',
icon: LucideLayoutGrid,
to: AGENT_PORTAL_DASHBOARD,
},
{
label: 'Agents',
icon: LucideUser,
to: AGENT_PORTAL_AGENT_LIST,
},
{
label: 'Knowledge base',
icon: LucideBookOpen,
to: 'DeskKBHome',
isBeta: true,
},
]);
const extraOptions = [
{
label: 'Teams',
icon: LucideUsers,
to: AGENT_PORTAL_TEAM_LIST,
},
{
label: 'Escalation rules',
icon: LucideArrowUpFromLine,
to: AGENT_PORTAL_ESCALATION_RULE_LIST,
isBeta: true,
},
{
label: 'Ticket types',
icon: LucideFolderOpen,
to: AGENT_PORTAL_TICKET_TYPE_LIST,
hide: true,
},
{
label: 'Canned responses',
icon: LucideCloudLightning,
to: AGENT_PORTAL_CANNED_RESPONSE_LIST,
isBeta: true,
},
{
label: 'Customers',
icon: LucideUserCircle2,
to: AGENT_PORTAL_CUSTOMER_LIST,
},
{
label: 'Contacts',
icon: LucideContact2,
to: AGENT_PORTAL_CONTACT_LIST,
},
];
const menuOptions = computed(() =>
[
{
label: 'Tickets',
icon: LucideTicket,
to: AGENT_PORTAL_TICKET_LIST,
},
{
label: 'Dashboard',
icon: LucideLayoutGrid,
to: AGENT_PORTAL_DASHBOARD,
},
{
label: 'Agents',
icon: LucideUser,
to: AGENT_PORTAL_AGENT_LIST,
hide: !authStore.isAgent,
},
{
label: 'Knowledge base',
icon: LucideBookOpen,
to: 'DeskKBHome',
isBeta: true,
},
{
label: 'Teams',
icon: LucideUsers,
to: AGENT_PORTAL_TEAM_LIST,
hide: !authStore.isAgent,
},
{
label: 'Escalation rules',
icon: LucideArrowUpFromLine,
to: AGENT_PORTAL_ESCALATION_RULE_LIST,
isBeta: true,
hide: !authStore.isAgent,
},
{
label: 'Ticket types',
icon: LucideFolderOpen,
to: AGENT_PORTAL_TICKET_TYPE_LIST,
hide: true,
},
{
label: 'Canned responses',
icon: LucideCloudLightning,
to: AGENT_PORTAL_CANNED_RESPONSE_LIST,
isBeta: true,
hide: !authStore.isAgent,
},
{
label: 'Customers',
icon: LucideUserCircle2,
to: AGENT_PORTAL_CUSTOMER_LIST,
hide: !authStore.isAgent,
},
{
label: 'Contacts',
icon: LucideContact2,
to: AGENT_PORTAL_CONTACT_LIST,
hide: !authStore.isAgent,
},
].filter((option) => !option.hide)
);
const profileSettings = [

Check warning on line 178 in desk/src/components/AppSidebar.vue

View workflow job for this annotation

GitHub Actions / ESLint - Reviewdog

[eslint] reported by reviewdog 🐶 'profileSettings' is assigned a value but never used. Raw Output: {"ruleId":"@typescript-eslint/no-unused-vars","severity":1,"message":"'profileSettings' is assigned a value but never used.","line":178,"column":7,"nodeType":"Identifier","messageId":"unusedVar","endLine":178,"endColumn":22}
{
Expand Down
35 changes: 18 additions & 17 deletions desk/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
export { default as AttachmentItem } from "./AttachmentItem.vue";
export { default as BreadCrumbs } from "./BreadCrumbs.vue";
export { default as CommandPalette } from "./command-palette/CP.vue";
export { default as ColumnSelector } from "./ColumnSelector.vue";
export { default as FilterPopover } from "./FilterPopover.vue";
export { default as HCard } from "./HCard.vue";
export { default as ListView } from "./list-view/LV.vue";
export { default as NestedPopover } from "./NestedPopover.vue";
export { default as Notifications } from "./notifications/Notifications.vue";
export { default as PageTitle } from "./PageTitle.vue";
export { default as SearchComplete } from "./SearchComplete.vue";
export { default as SidebarLink } from "./SidebarLink.vue";
export { default as StarRating } from "./StarRating.vue";
export { default as TextEditor } from "./TextEditor.vue";
export { default as TimelineItem } from "./TimelineItem.vue";
export { default as UniInput } from "./UniInput.vue";
export { default as UserAvatar } from "./UserAvatar.vue";
export { default as AppSidebar } from './AppSidebar.vue';
export { default as AttachmentItem } from './AttachmentItem.vue';
export { default as BreadCrumbs } from './BreadCrumbs.vue';
export { default as ColumnSelector } from './ColumnSelector.vue';
export { default as CommandPalette } from './command-palette/CP.vue';
export { default as FilterPopover } from './FilterPopover.vue';
export { default as HCard } from './HCard.vue';
export { default as ListView } from './list-view/LV.vue';
export { default as NestedPopover } from './NestedPopover.vue';
export { default as Notifications } from './notifications/Notifications.vue';
export { default as PageTitle } from './PageTitle.vue';
export { default as SearchComplete } from './SearchComplete.vue';
export { default as SidebarLink } from './SidebarLink.vue';
export { default as StarRating } from './StarRating.vue';
export { default as TextEditor } from './TextEditor.vue';
export { default as TimelineItem } from './TimelineItem.vue';
export { default as UniInput } from './UniInput.vue';
export { default as UserAvatar } from './UserAvatar.vue';
10 changes: 8 additions & 2 deletions desk/src/components/list-view/LVRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@
@click="(event) => filterFunc(event, c)"
>
<slot :name="c.fieldname" :data="data">
{{ data[c.fieldname] || '⸺' }}
<span v-if="c.type === 'timeAgo' && data[c.fieldname]">
<Tooltip :text="dayjs(data[c.fieldname]).long()">
{{ dayjs(data[c.fieldname]).fromNow() }}
</Tooltip>
</span>
<span v-else>{{ data[c.fieldname] || '⸺' }}</span>
</slot>
</div>
</div>
Expand All @@ -56,10 +61,11 @@
<script setup lang="ts">
import { inject } from 'vue';
import { RouterLink } from 'vue-router';
import { FormControl } from 'frappe-ui';
import { FormControl, Tooltip } from 'frappe-ui';
import { isFunction } from 'lodash';
import { Column } from '@/types';
import { getAssign } from '@/utils';
import { dayjs } from '@/dayjs';
import { useFieldsStore } from '@/stores/fields';
import { useColumns } from '@/composables/columns';
import { useFilter } from '@/composables/filter';
Expand Down
28 changes: 15 additions & 13 deletions desk/src/pages/desk/AgentRoot.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<div class="flex h-screen w-screen">
<SideBar />
<Notifications />
<!-- <SideBar /> -->
<AppSidebar />
<!-- <Notifications /> -->
<RouterView class="z-0 grow overflow-auto" />
<CommandPalette />
</div>
Expand All @@ -13,20 +14,21 @@ import { useRouter } from 'vue-router';
import { useAuthStore } from '@/stores/auth';
import { useConfigStore } from '@/stores/config';
import { CUSTOMER_PORTAL_LANDING, ONBOARDING_PAGE } from '@/router';
import { CommandPalette, Notifications } from '@/components';
import SideBar from '@/components/desk/sidebar/SideBar.vue';
// import { AppSidebar, CommandPalette, Notifications } from '@/components';
import { AppSidebar, CommandPalette } from '@/components';
// import SideBar from '@/components/desk/sidebar/SideBar.vue';
const router = useRouter();
const authStore = useAuthStore();
const configStore = useConfigStore();
onBeforeMount(() => {
if (!authStore.hasDeskAccess) {
router.replace({ name: CUSTOMER_PORTAL_LANDING });
}
if (!configStore.isSetupComplete) {
router.replace({ name: ONBOARDING_PAGE });
}
});
// onBeforeMount(() => {
// if (!authStore.hasDeskAccess) {
// router.replace({ name: CUSTOMER_PORTAL_LANDING });
// }
//
// if (!configStore.isSetupComplete) {
// router.replace({ name: ONBOARDING_PAGE });
// }
// });
</script>
21 changes: 10 additions & 11 deletions desk/src/pages/desk/DeskDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<template #right>
<Tooltip v-if="!isEmpty(items.data)" placement="left" :text="dateInfo">
<div class="flex h-7 w-7 items-center justify-between">
<IconInfo class="h-5 w-5 text-gray-700" />
<LucideInfo class="h-4 w-4" />
</div>
</Tooltip>
</template>
Expand Down Expand Up @@ -48,25 +48,24 @@
</template>

<script setup lang="ts">
import { createResource, usePageMeta, Tooltip } from "frappe-ui";
import { isEmpty } from "lodash";
import PageTitle from "@/components/PageTitle.vue";
import LineChart from "@/components/charts/LineChart.vue";
import PieChart from "@/components/charts/PieChart.vue";
import SingleString from "@/components/charts/SingleString.vue";
import IconInfo from "~icons/espresso/alert-circle";
import { createResource, usePageMeta, Tooltip } from 'frappe-ui';
import { isEmpty } from 'lodash';
import PageTitle from '@/components/PageTitle.vue';
import LineChart from '@/components/charts/LineChart.vue';
import PieChart from '@/components/charts/PieChart.vue';
import SingleString from '@/components/charts/SingleString.vue';
const items = createResource({
url: "helpdesk.api.dashboard.get_all",
url: 'helpdesk.api.dashboard.get',
auto: true,
});
const dateInfo =
"📊 The information displayed in these charts are derived from data collected over the past 30 days";
'📊 The information displayed in these charts are derived from data collected over the past 30 days';
usePageMeta(() => {
return {
title: "Dashboard",
title: 'Dashboard',
};
});
</script>
4 changes: 0 additions & 4 deletions desk/src/pages/tickets/TicketsAgent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ const pageLength = ref(20);
const tickets = createListManager({
doctype: 'HD Ticket',
pageLength: pageLength.value,
filters: {
status: 'Resolved',
agent_group: 'Random Team',
},
orderBy: getOrder(),
auto: true,
transform: (data) => {
Expand Down
Loading

0 comments on commit 904ebd6

Please sign in to comment.