Skip to content

Commit

Permalink
fix: add notifications and command pallete back to desktop layout
Browse files Browse the repository at this point in the history
  • Loading branch information
RitvikSardana committed Aug 31, 2024
1 parent 175602d commit 24a833b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions desk/src/components/layouts/DesktopLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
<AppHeader />
<slot />
</div>
<Notifications />
<CommandPalette />
</div>
</template>
<script setup>
import { Notifications, CommandPalette } from "@/components";
import AppHeader from "./AppHeader.vue";
import Sidebar from "./Sidebar.vue";
</script>
10 changes: 8 additions & 2 deletions desk/src/composables/screen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { onMounted, onUnmounted, reactive } from "vue";
import { computed, onMounted, onUnmounted, reactive } from "vue";

export function useScreenSize() {
const size = reactive({
Expand All @@ -19,5 +19,11 @@ export function useScreenSize() {
window.removeEventListener("resize", onResize);
});

return size;
const mobileThreshold = 640;
const isMobileView = computed(() => size.width < mobileThreshold);

return {
size,
isMobileView,
};
}
9 changes: 4 additions & 5 deletions desk/src/pages/desk/AgentRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<Layout>
<router-view class="z-0 flex flex-1 flex-col overflow-auto" />
</Layout>
<CommandPalette />
<Notifications />
</template>

<script setup lang="ts">
Expand All @@ -12,22 +10,23 @@ 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 { useScreenSize } from "@/composables/screen";
const router = useRouter();
const authStore = useAuthStore();
const configStore = useConfigStore();
const screenSize = useScreenSize();
const { isMobileView } = useScreenSize();
const MobileLayout = defineAsyncComponent(
() => import("@/components/Layouts/MobileLayout.vue")
);
const DesktopLayout = defineAsyncComponent(
() => import("@/components/Layouts/DesktopLayout.vue")
);
const Layout = computed(() => {
if (screenSize.width < 640) {
if (isMobileView.value) {
return MobileLayout;
} else {
return DesktopLayout;
Expand Down

0 comments on commit 24a833b

Please sign in to comment.