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