Implement shopping cart functionality with UI components and API integration
- Added CartItem, CartSummary, CartEmpty, CartSidebar, and CartSheet components for managing cart display and interactions. - Integrated useCart and useCartUI composables for cart state management and UI control. - Implemented API endpoints for cart operations, including fetching, adding, updating, and removing items. - Enhanced user experience with loading states and notifications using vue-sonner for cart actions. - Configured session management for guest and authenticated users, ensuring cart persistence across sessions. This commit completes the shopping cart feature, enabling users to add items, view their cart, and proceed to checkout. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import AppHeader from '~/components/navigation/AppHeader.vue'
|
||||
import BottomNav from '~/components/navigation/BottomNav.vue'
|
||||
import CartFAB from '~/components/Cart/CartFAB.vue'
|
||||
import CartSidebar from '~/components/Cart/CartSidebar.vue'
|
||||
import CartSheet from '~/components/Cart/CartSheet.vue'
|
||||
import { Toaster } from '~/components/ui/sonner'
|
||||
|
||||
// Determine which cart UI to show based on screen size
|
||||
const { isMobile } = useCartUI()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -18,6 +25,18 @@ import BottomNav from '~/components/navigation/BottomNav.vue'
|
||||
|
||||
<!-- Mobile Bottom Navigation -->
|
||||
<BottomNav />
|
||||
|
||||
<!-- Floating Action Button (FAB) for Cart on Product Pages -->
|
||||
<CartFAB />
|
||||
|
||||
<!-- Cart Sidebar (Desktop: >= 1024px) -->
|
||||
<CartSidebar v-if="!isMobile" />
|
||||
|
||||
<!-- Cart Sheet (Mobile: < 1024px) -->
|
||||
<CartSheet v-if="isMobile" />
|
||||
|
||||
<!-- Toast Notifications -->
|
||||
<Toaster position="top-center" :duration="3000" rich-colors />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user