This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { Home, Building, Calendar, CreditCard, Briefcase, BookOpen } from "lucide-react";
|
||||
import { Home, Building2, Building, CalendarCheck, CalendarDays, ClipboardList, CreditCard, BookOpenCheck } from "lucide-react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { label } from "framer-motion/client";
|
||||
@ -19,18 +19,20 @@ export default function BottomNav({ isOwner, isOwnerOrAgent }) {
|
||||
|
||||
const items = [
|
||||
{ href: "/", label: t("home"), icon: Home },
|
||||
{ href: "/properties", label: t("ourProperties"), icon: Building },
|
||||
{ href: "/properties", label: t("ourProperties"), icon: Building2 },
|
||||
|
||||
...(isOwnerOrAgent
|
||||
? [
|
||||
{ href: "/owner/properties", label: t("myProperties"), icon: Briefcase },
|
||||
{ href: "/owner/bookings", label: "عقاراتي المحجوزة", icon: Briefcase },
|
||||
{ href: "/reservations", label: "حجوزاتي", icon: Calendar },
|
||||
{ href: "/owner/properties", label: t("myProperties"), icon: Building },
|
||||
{ href: "/owner/bookings", label: "عقاراتي المحجوزة", icon: CalendarCheck },
|
||||
{ href: "/reservations", label: "حجوزاتي", icon: CalendarDays },
|
||||
]
|
||||
: [{ href: "/booked-properties", label: "حجوزاتي", icon: Briefcase }]),
|
||||
{ href: bookingsHref, label: "طلبات الحجز", icon: Calendar },
|
||||
: [{ href: "/booked-properties", label: "حجوزاتي", icon: CalendarDays }]),
|
||||
|
||||
{ href: bookingsHref, label: "طلبات الحجز", icon: ClipboardList },
|
||||
{ href: "/payments", label: t("payments"), icon: CreditCard },
|
||||
...(isOwnerOrAgent ? [{ href: "/owner/account-book", label: t("accountBook"), icon: BookOpen }] : []),
|
||||
|
||||
...(isOwnerOrAgent ? [{ href: "/owner/account-book", label: t("accountBook"), icon: BookOpenCheck }] : []),
|
||||
];
|
||||
|
||||
const isActive = (href) => {
|
||||
@ -39,13 +41,13 @@ export default function BottomNav({ isOwner, isOwnerOrAgent }) {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="fixed bottom-0 left-0 right-0 z-50 flex justify-center px-1 pb-4 pt-4 pointer-events-none">
|
||||
<div className="fixed bottom-0 left-0 right-0 z-50 flex justify-center px-5 pb-4 pt-4 pointer-events-none">
|
||||
<nav
|
||||
className="
|
||||
w-fit max-w-full
|
||||
rounded-3xl
|
||||
bg-gray-50
|
||||
px-1 py-3 sm:px-4
|
||||
px-5 py-3 sm:px-4
|
||||
shadow-[0_4px_24px_rgba(251,146,60,0.25)]
|
||||
pointer-events-auto
|
||||
"
|
||||
@ -59,7 +61,7 @@ export default function BottomNav({ isOwner, isOwnerOrAgent }) {
|
||||
<Link
|
||||
key={it.href}
|
||||
href={it.href}
|
||||
style={{padding:'10px',width:'100px'}}
|
||||
style={{ padding: "3px", width: "100px" }}
|
||||
className={`
|
||||
|
||||
flex
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState, useRef } from "react";
|
||||
import { initializeApp, getApps } from "firebase/app";
|
||||
import { getMessaging, getToken, onMessage } from "firebase/messaging";
|
||||
import AuthService from "../services/AuthService";
|
||||
import { setFCMToken } from "../utils/api";
|
||||
|
||||
//فاير بيز
|
||||
const firebaseConfig = {
|
||||
apiKey: "AIzaSyBZV7KBLRJSTApahfrO8lBesmIM3zNRSaY",
|
||||
authDomain: "sweet-home-b2766.firebaseapp.com",
|
||||
@ -16,6 +16,7 @@ const firebaseConfig = {
|
||||
measurementId: "G-M2V95NBJLX",
|
||||
};
|
||||
|
||||
//عم نعمل تهيئة للاعدادات
|
||||
const app = getApps().length === 0 ? initializeApp(firebaseConfig) : getApps()[0];
|
||||
|
||||
export default function NotificationHandler() {
|
||||
@ -26,11 +27,10 @@ export default function NotificationHandler() {
|
||||
useEffect(() => {
|
||||
function checkAuth() {
|
||||
if (initialized.current) return;
|
||||
|
||||
if (!AuthService.getToken()) return;
|
||||
initialized.current = true;
|
||||
|
||||
if ("Notification" in window) {
|
||||
//عم نشوف اذا حط سماح او رفض
|
||||
if (Notification.permission === "default") {
|
||||
setShowPrompt(true);
|
||||
} else if (Notification.permission === "granted") {
|
||||
|
||||
@ -38,8 +38,7 @@ export async function requestNotificationPermission() {
|
||||
);
|
||||
|
||||
const token = await getToken(messaging, {
|
||||
vapidKey:
|
||||
"BGZ4Fo8rRhoTdStLGlCySDZOnAX4ekCA0e3HDWXL5uEi2kOnXynYjbaDbY15002phUrFqxBpPPFHgfH2VhrmFDU",
|
||||
vapidKey:"BGZ4Fo8rRhoTdStLGlCySDZOnAX4ekCA0e3HDWXL5uEi2kOnXynYjbaDbY15002phUrFqxBpPPFHgfH2VhrmFDU",
|
||||
serviceWorkerRegistration: registration,
|
||||
});
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
importScripts("https://www.gstatic.com/firebasejs/10.12.0/firebase-app-compat.js");
|
||||
importScripts("https://www.gstatic.com/firebasejs/10.12.0/firebase-messaging-compat.js");
|
||||
|
||||
//من فاير بيز
|
||||
firebase.initializeApp({
|
||||
apiKey: "AIzaSyBZV7KBLRJSTApahfrO8lBesmIM3zNRSaY",
|
||||
authDomain: "sweet-home-b2766.firebaseapp.com",
|
||||
@ -14,6 +15,7 @@ firebase.initializeApp({
|
||||
measurementId: "G-M2V95NBJLX",
|
||||
});
|
||||
|
||||
//ننشئ رسالة
|
||||
const messaging = firebase.messaging();
|
||||
|
||||
// Handle background messages
|
||||
@ -31,6 +33,7 @@ messaging.onBackgroundMessage((payload) => {
|
||||
});
|
||||
|
||||
// Handle notification click
|
||||
//اذا ضغطنا ع الاشعار شو بصير
|
||||
self.addEventListener("notificationclick", (event) => {
|
||||
event.notification.close();
|
||||
const url = event.notification.data?.url || "/";
|
||||
|
||||
Reference in New Issue
Block a user