Skip to content

Commit

Permalink
dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
asmaamostafa74 committed Nov 14, 2024
1 parent d139f1e commit 83898f5
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 65 deletions.
22 changes: 6 additions & 16 deletions src/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

<!-- Start Content -->
<section class="container mx-auto flex gap-16 mt-[40px] mb-[72px]">
<div x-data="{ activePage: 'dashboard' }" class="md:flex gap-[72px]">
<div x-data="{ open: false }">
<div x-data="{ activePage: 'dashboard' }" class="md:flex">
<!-- <div x-data="{ open: false }">
<button @click="open = !open" class="md:hidden flex items-center gap-5 p-[3px] text-gray-800">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7"></path>
Expand Down Expand Up @@ -108,7 +108,6 @@
<p class="text-[#5F6C72] font-normal">Log-out</p>
</li>
<!-- Logout Confirmation Modal -->
<div x-show="showLogoutModal" class="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50" x-cloak x-transition>
<div class="bg-white p-6 rounded-md shadow-lg w-[300px]">
<h2 class="text-lg font-semibold mb-4">Confirm Log-out</h2>
Expand All @@ -123,7 +122,7 @@ <h2 class="text-lg font-semibold mb-4">Confirm Log-out</h2>
</ul>
</div>
</div>

-->
<!-- Content -->
<div class="flex-1">
<!-- Dashboard Page -->
Expand Down Expand Up @@ -212,18 +211,9 @@ <h2 class="text-[#191C1F] font-medium text-sm uppercase">Recent Order</h2>
<td class="py-3 px-4 text-[#5F6C72]">Dec 30, 2019 05:18</td>
<td class="py-3 px-4 text-[#475156]">$1,500 (5 Products)</td>
<td class="py-3 px-4">
<a @click="activePage = 'orderDetails'" class="flex items-center gap-2 font-medium text-[#2DA5F3]">
View
<img src="../assets/images/blueArrow.svg" class="transform ltr:scale-x-100 rtl:scale-x-[-1]" alt="Arrow">
</a>

<!-- Content section that will be displayed when the link is clicked -->
<div x-show="activePage === 'orderDetails'" x-transition>
<!-- Your content here -->
<h2>Order Details</h2>
<p>Information about the order goes here...</p>
</div>

<a href="./orderDetails.html" class="flex items-center gap-2 font-medium text-[#2DA5F3]">View Details
<img src="../assets/images/blueArrow.svg" class="transform ltr:scale-x-100 rtl:scale-x-[-1]" alt="Arrow">
</a>
</td>
</tr>
<tr>
Expand Down
12 changes: 6 additions & 6 deletions src/dashboardSetting.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<!-- Start Content -->
<section class="container mx-auto flex gap-16 mt-[40px] mb-[72px]">
<div id="sidebar" class="md:hidden block sidebar fixed left-0 top-0 w-[264px] h-full border border-[#E4E7E9] shadow-md transform -translate-x-full bg-white z-50 transform transition-transform duration-300 ease">
<!-- <div id="sidebar" class="md:hidden block sidebar fixed left-0 top-0 w-[264px] h-full border border-[#E4E7E9] shadow-md transform -translate-x-full bg-white z-50 transform transition-transform duration-300 ease">
<button id="closeSidebar" class="flex items-center justify-end w-full h-[40px] ltr:pl-6 rtl:pr-6 cursor-pointer text-[#5F6C72]">
<img src="../assets/images/closeIcon.svg" alt="Close" class="w-6 h-6">
</button>
Expand Down Expand Up @@ -80,8 +80,8 @@
<p class="text-[#5F6C72] text-sm font-normal">Log-out</p>
</li>
</ul>
</div>
<div class="md:block hidden w-[264px] h-[432px] border border-[#E4E7E9]" style="box-shadow: 0px 8px 40px 0px #00000014;">
</div> -->
<!-- <div class="md:block hidden w-[264px] h-[432px] border border-[#E4E7E9]" style="box-shadow: 0px 8px 40px 0px #00000014;">
<ul class="mt-4">
<a href="./dashboard.html" class="flex items-center gap-3 w-[264px] h-[40px] ltr:pl-6 rtl:pr-6 cursor-pointer">
<img src="../assets/images/Stackgray.svg" alt="Stack">
Expand Down Expand Up @@ -124,13 +124,13 @@
<p class="text-[#5F6C72] text-sm font-normal">Log-out</p>
</li>
</ul>
</div>
</div> -->
<div class="md:px-0 px-2">
<!-- Account Info -->
<button id="toggleButton" class="md:hidden flex items-center gap-2 mb-4 text-white rounded">
<!-- <button id="toggleButton" class="md:hidden flex items-center gap-2 mb-4 text-white rounded">
<img src="../assets/images/burger-menu.svg" class="w-6 h-6" alt="Toggle Sidebar">
<p class="text-black">Dashboard</p>
</button>
</button> -->
<div class="md:w-[984px] md:h-[508px] border border-[#E4E7E9]">
<h1 class="text-[#191C1F] text-sm font-semibold uppercase ltr:pl-6 rtl:pr-6 py-4">Account Setting</h1>
<hr>
Expand Down
119 changes: 83 additions & 36 deletions src/dashboardTest.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
</style>
</head>
<body class="bg-gray-100">
<body class="container mx-auto">

<!--hello! this is an example with alpine to how i thought about what the taps should look like-->
<!--we'll just keep track of the previous active state and add a transition effect accordingly-->
Expand All @@ -35,45 +35,54 @@

<div x-data="tabs()" class="flex h-screen">
<!-- Sidebar -->
<div class="w-64 bg-white shadow-lg">
<div class="w-[264px] h-[446px] bg-white shadow-lg mt-[170px]">
<ul class="py-4">
<template x-for="(tab, index) in tabItems" :key="index">
<li class="mb-2">
<button
@click="selectTab(index)"
:class="{ 'bg-blue-500 text-white': activeTab === index, 'hover:bg-gray-200': activeTab !== index }"
class="w-full px-4 py-2 text-left transition-colors duration-200"
x-text="tab.name"
></button>
@click="selectTab(index)"
:class="{ 'bg-[#FA8232] text-white': activeTab === index, 'hover:bg-gray-200': activeTab !== index }"
class="w-full px-4 py-2 text-left transition-colors duration-200 flex items-center space-x-2"
>
<img :src="activeTab === index ? tab.activeIcon : tab.icon" alt="Tab Icon" class="w-5 h-5">
<span x-text="tab.name"></span>
</button>
<div x-show="showLogoutModal" class="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50" x-cloak x-transition>
<div class="bg-white p-6 rounded-md shadow-lg w-[300px]">
<h2 class="text-lg font-semibold mb-4">Confirm Log-out</h2>
<p class="mb-6">Are you sure you want to log out?</p>
<div class="flex justify-end gap-3">
<button @click="showLogoutModal = false" class="bg-gray-300 px-4 py-2 rounded-md">Cancel</button>
<button class="bg-[#FA8232] text-white px-4 py-2 rounded-md">Log-out</button>
</div>
</div>
</div>
</li>
</template>
</ul>
</div>

<!-- Content Area -->
<div class="flex-1 p-8 relative overflow-hidden">
<template x-for="(tab, index) in tabItems" :key="index">
<div class="flex-1 p-8 relative ">

<div
class="absolute flex items-center justify-center"
:class="{ 'z-10': activeTab === index, 'z-0': activeTab !== index }"
x-show="true"
:style="activeTab === index ? '' : 'pointer-events: none;'"
>
<div
x-show="true"
:style="activeTab === index ? '' : 'pointer-events: none;'"
class="absolute inset-0 flex items-center justify-center"
:class="{ 'z-10': activeTab === index, 'z-0': activeTab !== index }"
>
<div
class="bg-white shadow-lg rounded-lg p-6 w-full max-w-2xl content-card"
:class="{
'slide-up-enter': index > previousTab && activeTab === index,
'slide-up-leave': index < activeTab && activeTab !== index,
'slide-down-enter': index < previousTab && activeTab === index,
'slide-down-leave': index > activeTab && activeTab !== index,
'opacity-0': activeTab !== index
}"
>
<h2 x-text="tab.name" class="text-2xl font-bold mb-4"></h2>
<p x-text="tab.content" class="text-gray-600"></p>
</div>
</div>
</template>
class="rounded-lg p-6 content-card"
:class="{
'slide-up-enter': index > previousTab && activeTab === index,
'slide-up-leave': index < activeTab && activeTab !== index,
'slide-down-enter': index < previousTab && activeTab === index,
'slide-down-leave': index > activeTab && activeTab !== index,
'opacity-0': activeTab !== index
}"
x-html="currentContent"
></div>
</div>
</div>
</div>

Expand All @@ -82,18 +91,56 @@ <h2 x-text="tab.name" class="text-2xl font-bold mb-4"></h2>
return {
activeTab: 0,
previousTab: 0,
showLogoutModal: false,
tabItems: [
{ name: 'Dashboard', content: 'Welcome to your dashboard. Here you can view an overview of your account and recent activities.' },
{ name: 'Order History', content: 'View your past orders, track shipments, and manage returns all in one place.' },
{ name: 'Track Order', content: 'Enter your order number to get real-time updates on your package\'s location and estimated delivery date.' },
{ name: 'Shopping Cart', content: 'Your shopping cart is currently empty. Add items to your cart to proceed to checkout.' },
{ name: 'Wishlist', content: 'Keep track of items you love. Add products to your wishlist for easy access later.' },
{ name: 'Dashboard', url: './dashboard.html', icon: '../assets/images/Stackgray.svg', activeIcon: '../assets/images/Stackwhite.svg' },
{ name: 'Order History', url: './orderHistory.html', icon: '../assets/images/[email protected]', activeIcon: '../assets/images/StorefrontW.svg' },
{ name: 'Track Order', url: './trackOrder.html', icon: '../assets/images/MapPinLine.svg', activeIcon: '../assets/images/MapPinLine.svg' },
{ name: 'Shopping Cart', url: 'shopping-cart.html', icon: '../assets/images/ShoppingCartSimple.svg', activeIcon: '../assets/images/ShoppingCartSimple.svg' },
{ name: 'Wishlist', url: './whishlist.html', icon: '../assets/images/Heart.svg', activeIcon: '../assets/images/Heart.svg' },
{ name: 'Compare', url: './compare', icon: '../assets/images/ArrowsCounterClockwise.svg', activeIcon: '../assets/images/ArrowsCounterClockwise.svg' },
{ name: 'Cards & Address', url: './cards', icon: '../assets/images/NotebookGray.svg', activeIcon: '../assets/images/NotebookGray.svg' },
{ name: 'Setting', url: './dashboardSetting.html', icon: '../assets/images/Gear.svg', activeIcon: '../assets/images/whiteGear.svg' },
{ name: 'Log-out', icon: '../assets/images/SignOut.svg', activeIcon: '../assets/images/SignOut.svg' },
],
selectTab(index) {

currentContent: '',

async init() {
await this.selectTab(this.activeTab);
},

async selectTab(index) {
this.previousTab = this.activeTab;

if (this.tabItems[index].name === 'Log-out') {
this.showLogoutModal = true;
return;
}

this.activeTab = index;

try {
const response = await fetch(this.tabItems[index].url);
if (response.ok) {
this.currentContent = await response.text();
} else {
this.currentContent = 'Error loading content. Please try again later.';
}
} catch (error) {
this.currentContent = 'Error loading content. Please check your connection.';
}
},

confirmLogout() {
console.log('User confirmed logout');
this.showLogoutModal = false;
},

cancelLogout() {
this.showLogoutModal = false;
}
}
};
}
</script>
</body>
Expand Down
12 changes: 6 additions & 6 deletions src/orderHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<!-- Start Content -->
<section class="container mx-auto flex gap-16 mt-[40px] mb-[72px]">
<!-- Sidebar -->
<div id="sidebar" class="md:hidden block sidebar fixed left-0 top-0 w-[264px] h-full border border-[#E4E7E9] shadow-md transform -translate-x-full bg-white z-50 transform transition-transform duration-300 ease">
<!-- <div id="sidebar" class="md:hidden block sidebar fixed left-0 top-0 w-[264px] h-full border border-[#E4E7E9] shadow-md transform -translate-x-full bg-white z-50 transform transition-transform duration-300 ease">
<button id="closeSidebar" class="flex items-center justify-end w-full h-[40px] ltr:pl-6 rtl:pr-6 cursor-pointer text-[#5F6C72]">
<img src="../assets/images/closeIcon.svg" alt="Close" class="w-6 h-6">
</button>
Expand Down Expand Up @@ -81,9 +81,9 @@
<p class="text-[#5F6C72] text-sm font-normal">Log-out</p>
</li>
</ul>
</div>
</div> -->

<div class="md:block hidden w-[264px] h-[432px] border border-[#E4E7E9]" style="box-shadow: 0px 8px 40px 0px #00000014;">
<!-- <div class="md:block hidden w-[264px] h-[432px] border border-[#E4E7E9]" style="box-shadow: 0px 8px 40px 0px #00000014;">
<ul class="mt-4">
<a href="./dashboard.html" class="flex items-center gap-3 w-[264px] h-[40px] ltr:pl-6 rtl:pr-6 cursor-pointer">
<img src="../assets/images/Stackgray.svg" alt="Stack">
Expand Down Expand Up @@ -126,13 +126,13 @@
<p class="text-[#5F6C72] text-sm font-normal">Log-out</p>
</li>
</ul>
</div>
</div> -->

<div class="w-full md:w-[984px] md:px-0 px-2">
<button id="toggleButton" class="md:hidden flex items-center gap-2 mb-4 text-white rounded">
<!-- <button id="toggleButton" class="md:hidden flex items-center gap-2 mb-4 text-white rounded">
<img src="../assets/images/burger-menu.svg" class="w-6 h-6" alt="Toggle Sidebar">
<p class="text-black">Dashboard</p>
</button>
</button> -->
<div class="bg-white border border-[#E4E7E9] rounded-[4px] overflow-hidden">
<div class="flex justify-between items-center px-6 py-4 border-b">
<h2 class="text-[#191C1F] font-medium text-sm uppercase">Recent Order</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/trackOrder.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<!-- End Location -->

<!-- Start Search -->
<div class="container mx-auto mt-12 mb-24 ltr:md:pl-[270px] ltr:pl-5 rtl:md:pr-[270px] rtl:pr-5">
<div class="container mx-auto mt-12 mb-24 ">
<h1 class="text-[#191C1F] text-[32px] font-semibold leading-[40px]">Track Order</h1>
<p class="md:w-[760px] text-[#5F6C72] mt-4 text-base font-normal">To track your order please enter your order ID in the input field below and press the “Track Order” button. this was given to you on your receipt and in the confirmation email you should have received.</p>
<form class="flex flex-wrap gap-3 mt-6">
Expand Down

0 comments on commit 83898f5

Please sign in to comment.