From 48f46ec9fe683c0befdd19f5bc5654c327133bed Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 7 May 2024 21:52:14 +0300 Subject: [PATCH 1/8] protect some common pages --- pages/contactUs.tsx | 26 ++++++------ pages/feedback.tsx | 9 +++-- pages/guidelines.tsx | 96 +++++++++++++++++++++++--------------------- pages/permits.tsx | 91 +++++++++++++++++++++-------------------- 4 files changed, 117 insertions(+), 105 deletions(-) diff --git a/pages/contactUs.tsx b/pages/contactUs.tsx index b29af89..890a552 100644 --- a/pages/contactUs.tsx +++ b/pages/contactUs.tsx @@ -2,20 +2,22 @@ import React from 'react'; import Layout from "../components/layout"; import FeedbackForm from "../components/reports/FeedbackForm"; import { useTranslations } from 'next-intl'; +import ProtectedRoute from "../components/protectedRoute"; const ContactsPage = () => { const t = useTranslations('common'); return ( -
-

{t('appNameLong') - t('contacts')}

- -
Електронна поща: specialnosvidetelstvanesofia@gmail.com
+ +
+

{t('appNameLong') - t('contacts')}

+ +
Електронна поща: specialnosvidetelstvanesofia@gmail.com
- {/* - +
+
); }; diff --git a/pages/feedback.tsx b/pages/feedback.tsx index da89509..23909a8 100644 --- a/pages/feedback.tsx +++ b/pages/feedback.tsx @@ -1,13 +1,16 @@ import React from 'react'; import Layout from "../components/layout"; import FeedbackForm from "../components/reports/FeedbackForm"; +import ProtectedRoute from "../components/protectedRoute"; const ContactsPage = () => { return ( -
- -
+ +
+ +
+
); }; diff --git a/pages/guidelines.tsx b/pages/guidelines.tsx index 64abc8b..d7f394b 100644 --- a/pages/guidelines.tsx +++ b/pages/guidelines.tsx @@ -1,5 +1,6 @@ import React, { useState } from 'react'; import Layout from "../components/layout"; +import ProtectedRoute from "../components/protectedRoute"; const PDFViewerPage = () => { const [language, setLanguage] = useState('bg'); // default language is Bulgarian @@ -25,61 +26,64 @@ const PDFViewerPage = () => { }; return ( - -

Напътствия

-
-

Важни напътствия за службата

-
    -
  1. Покани за Възпоменанието: За кампанията ще използваме покани без конкретен адрес. Ще насочваме хората към най-близкото за тях място, чрез сайта или като попълним поканата.
  2. + + + +

    Напътствия

    +
    +

    Важни напътствия за службата

    +
      +
    1. Покани за Възпоменанието: За кампанията ще използваме покани без конкретен адрес. Ще насочваме хората към най-близкото за тях място, чрез сайта или като попълним поканата.
    2. -
    3. Щандове: Предлагаме следното: -
        -
      • Да има известно разстояние между нас и щандовете. Целта е да оставим хората свободно да се доближат до количките и ако някой прояви интерес може да се приближим.
      • -
      • Когато сме двама или трима може да стоим заедно. Ако сме четирима би било хубаво да се разделим по двама на количка и количките да са на известно разстояние една от друга.
      • -
      -
    4. -
    5. Безопасност: Нека се страем зад нас винаги да има защита или препятствие за недобронамерени хора.
    6. -
    7. Плакати: Моля при придвижване на количките да слагате плакатите така, че илюстрацията да се вижда, когато калъфа е сложен. Целта е снимките да не се търкат в количката, защото се повреждат.
    8. -
    9. Литература: При проявен интерес на чужд език, използвайте списанията и трактатите на други езици в папките.
    10. -
    11. График: Моля да ни изпратите вашите предпочитания до 23-то число на месеца като използвате меню Възможности
    12. -
    13. Случки: Ако сте имали хубави случки на количките, моля пишете ни.
    14. -
    +
  3. Щандове: Предлагаме следното: +
      +
    • Да има известно разстояние между нас и щандовете. Целта е да оставим хората свободно да се доближат до количките и ако някой прояви интерес може да се приближим.
    • +
    • Когато сме двама или трима може да стоим заедно. Ако сме четирима би било хубаво да се разделим по двама на количка и количките да са на известно разстояние една от друга.
    • +
    +
  4. +
  5. Безопасност: Нека се страем зад нас винаги да има защита или препятствие за недобронамерени хора.
  6. +
  7. Плакати: Моля при придвижване на количките да слагате плакатите така, че илюстрацията да се вижда, когато калъфа е сложен. Целта е снимките да не се търкат в количката, защото се повреждат.
  8. +
  9. Литература: При проявен интерес на чужд език, използвайте списанията и трактатите на други езици в папките.
  10. +
  11. График: Моля да ни изпратите вашите предпочитания до 23-то число на месеца като използвате меню Възможности
  12. +
  13. Случки: Ако сте имали хубави случки на количките, моля пишете ни.
  14. +
-
- -
{/* Adjust the 100px based on your header/footer size */} -
- {languages.map((lang, index) => ( - - {index > 0 &&
} {/* Vertical line separator */} - -
- ))}
-

- - Свали Напътствията - -

-
- - {/* +
{/* Adjust the 100px based on your header/footer size */} +
+ {languages.map((lang, index) => ( + + {index > 0 &&
} {/* Vertical line separator */} + +
+ ))} +
+

+ + Свали Напътствията + +

+ +
+ + {/*

Your browser does not support PDFs. Please download the PDF to view it: Свали PDF файла.

Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: Свали PDF файла.

*/} +
+ {/* */} + +
- {/* */} - - - - + + ); }; diff --git a/pages/permits.tsx b/pages/permits.tsx index 07bdf33..6175782 100644 --- a/pages/permits.tsx +++ b/pages/permits.tsx @@ -3,7 +3,7 @@ import Layout from "../components/layout"; import fs from 'fs'; import path from 'path'; import { url } from 'inspector'; -import ProtectedRoute, { serverSideAuth } from "/components/protectedRoute"; +import ProtectedRoute from "../components/protectedRoute"; import axiosInstance from '../src/axiosSecure'; import { UserRole } from "@prisma/client"; @@ -48,56 +48,59 @@ const PDFViewerPage = ({ pdfFiles }) => { return ( -

Разрешителни

- -
-
-

За да качите файл кликнете на бутона по-долу и изберете файл от вашия компютър.

- Разрешителни + +
+
+

За да качите файл кликнете на бутона по-долу и изберете файл от вашия компютър.

+ -
-
-

Съществуващи файлове:

- {files.length > 0 ? ( - files.map((file, index) => ( -
- - {file.name} - - -
- )) - ) : ( -

Няма качени файлове.

- )} -
-
- -
- -
{/* Adjust the 100px based on your header/footer size */} - {pdfFiles.map((file, index) => ( - <>

- - Свали: {file.name} - -

-
- < object data={file.url} type="application/pdf" style={{ width: '100%', height: '100%' }}> -

Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: Свали {file.name}.

-

Your browser does not support PDFs. Please download the PDF to view it: {file.name}.

-
- - ))} -
+
+

Съществуващи файлове:

+ {files.length > 0 ? ( + files.map((file, index) => ( +
+ + {file.name} + + +
+ )) + ) : ( +

Няма качени файлове.

+ )} +
+
+ + + +
{/* Adjust the 100px based on your header/footer size */} + {pdfFiles.map((file, index) => ( + <>

+ + Свали: {file.name} + +

+
+ < object data={file.url} type="application/pdf" style={{ width: '100%', height: '100%' }}> +

Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: Свали {file.name}.

+

Your browser does not support PDFs. Please download the PDF to view it: {file.name}.

+ +
+ + ))} +
+
+ ); }; From 6e139c92df6195e50c6c64c4d878073c3850a66c Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 7 May 2024 21:58:26 +0300 Subject: [PATCH 2/8] remove spaces --- .env | 3 --- 1 file changed, 3 deletions(-) diff --git a/.env b/.env index 614d1b9..0f125bf 100644 --- a/.env +++ b/.env @@ -37,9 +37,6 @@ APPLE_PK=-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdw #APPLE_SECRET=eyJhbGciOiJFUzI1NiIsImtpZCI6IlRCM1YzNTVHNVkifQ.eyJhdWQiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiaXNzIjoiWEM1N1A5U1hESyIsImlhdCI6MTcxMjE3ODM0MiwiZXhwIjoxNzI3NzMwMzQzLCJzdWIiOiJjb20ubXdoaXRuZXNzaW5nLnNvZmlhIn0.XceA0qUQi0tXg0GM_LkJkpNU5AqXLiSB2JlEVbHCB_nINbQTWkjtoWxfqmvdOkIzwKtvdQ8FFb-crK9no9Bbbw # to generate - - - AUTH0_ID=Aa9f3HJowauUrmBVY4iQzQJ7fYsaZDbK AUTH0_SECRET=_c0O9GkyRXkoWMQW7jNExnl6UoXN6O4oD3mg7NZ_uHVeAinCUtcTAkeQmcKXpZ4x AUTH0_ISSUER=https://dev-wkzi658ckibr1amv.us.auth0.com From 54be0439ca1b77b788fc6f4f0745814f6c314a86 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 8 May 2024 11:49:20 +0300 Subject: [PATCH 3/8] tighter user permissions for report pages --- pages/cart/reports/coverMe.tsx | 2 +- pages/cart/reports/experience.tsx | 2 +- pages/cart/reports/list.tsx | 2 +- pages/cart/reports/report.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/cart/reports/coverMe.tsx b/pages/cart/reports/coverMe.tsx index e076646..b90a0d5 100644 --- a/pages/cart/reports/coverMe.tsx +++ b/pages/cart/reports/coverMe.tsx @@ -42,7 +42,7 @@ export default function EventLogList() { }, []); return ( - +
diff --git a/pages/cart/reports/experience.tsx b/pages/cart/reports/experience.tsx index 9e4df08..b93cfd6 100644 --- a/pages/cart/reports/experience.tsx +++ b/pages/cart/reports/experience.tsx @@ -9,7 +9,7 @@ import ProtectedRoute from '../../../components/protectedRoute'; function NewPage(loc: Location) { return ( - +
diff --git a/pages/cart/reports/list.tsx b/pages/cart/reports/list.tsx index fc6d47c..0e451ea 100644 --- a/pages/cart/reports/list.tsx +++ b/pages/cart/reports/list.tsx @@ -83,7 +83,7 @@ export default function Reports() { }, []); return ( - +
diff --git a/pages/cart/reports/report.tsx b/pages/cart/reports/report.tsx index 8c7bcff..fc4e57a 100644 --- a/pages/cart/reports/report.tsx +++ b/pages/cart/reports/report.tsx @@ -9,7 +9,7 @@ import ProtectedRoute from '../../../components/protectedRoute'; function NewPage(loc: Location) { return ( - +
From 0e8d1284c2347c28d3206629e3adccf5f5fcc09f Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 8 May 2024 11:50:46 +0300 Subject: [PATCH 4/8] show stats for admins only --- pages/cart/publishers/stats.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/cart/publishers/stats.tsx b/pages/cart/publishers/stats.tsx index 2e8b558..ea3812e 100644 --- a/pages/cart/publishers/stats.tsx +++ b/pages/cart/publishers/stats.tsx @@ -21,7 +21,7 @@ function ContactsPage({ publishers, allPublishers }) { return ( - +

Статистика

{publishers.length} участника с предпочитания за месеца (от {allPublishers.length} )
From 71b5f198ed3084af85cf90a6bf9ea7d56e56a80c Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 8 May 2024 15:50:51 +0300 Subject: [PATCH 5/8] PwaManagerNotifications automatic permission request and subscription --- .env | 7 ++ components/PwaManager.tsx | 22 +++-- components/PwaManagerNotifications.tsx | 132 +++++++++++++++++++++++++ components/sidebar.tsx | 3 + 4 files changed, 158 insertions(+), 6 deletions(-) create mode 100644 components/PwaManagerNotifications.tsx diff --git a/.env b/.env index 614d1b9..a085b3c 100644 --- a/.env +++ b/.env @@ -14,9 +14,16 @@ NEXT_PUBLIC_PUBLIC_URL=https://localhost:3003 # // owner: dobromir.popov@gmail.com | Специално Свидетелстване София # // https://console.cloud.google.com/apis/credentials/oauthclient/926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com?project=grand-forge-108716 +# callback https://sofia.mwitnessing.com/api/auth/callback/google GOOGLE_ID=926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com GOOGLE_SECRET=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 + +# //https://sofia.mwitnessing.com/api/auth/callback/microsoft +# https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app +# owner: dobromirpopovgateway.onmicrosoft.com dobromir.popov@gateway.one (personal) Doby Popov P One +# callback https://sofia.mwhitnessing.com/api/auth/callback/azure-ad + AZURE_AD_CLIENT_ID=9e13bedd-1f9d-4c23-910e-a806aba308b6 # Application (client) ID AZURE_AD_CLIENT_SECRET=5ic8Q~GQmW-IUhuxzVGx3BE-i30GXDSpjfMHcb~z #client secret value AZURE_AD_TENANT_ID=f69d1a93-bfba-498a-9b60-e87c1bc26276 diff --git a/components/PwaManager.tsx b/components/PwaManager.tsx index c7787c8..1e30d27 100644 --- a/components/PwaManager.tsx +++ b/components/PwaManager.tsx @@ -6,7 +6,7 @@ import e from 'express'; import ProtectedRoute from './protectedRoute'; import { UserRole } from '@prisma/client'; -function PwaManager() { +function PwaManager({ subs }) { //ToDo: for iOS, try to use apn? https://github.com/node-apn/node-apn/blob/master/doc/apn.markdown const isSupported = () => 'Notification' in window && @@ -21,7 +21,7 @@ function PwaManager() { const [subscription, setSubscription] = useState(null); const [registration, setRegistration] = useState(null); const [notificationPermission, setNotificationPermission] = useState(isSupported() && Notification.permission); - const [subs, setSubs] = useState("") + const [_subs, setSubs] = useState(subs) const { data: session } = useSession(); // let isAdmin = ProtectedRoute.IsInRole(UserRole.ADMIN); @@ -39,14 +39,14 @@ function PwaManager() { // Handle Push Notification Subscription if ('serviceWorker' in navigator && 'PushManager' in window) { - navigator.serviceWorker.ready.then(reg => { - reg.pushManager.getSubscription().then(sub => { + navigator.serviceWorker.ready.then(swreg => { + swreg.pushManager.getSubscription().then(sub => { if (sub) { setSubscription(sub); setIsSubscribed(true); } }); - setRegistration(reg); + setRegistration(swreg); }); } @@ -341,7 +341,7 @@ function PwaManager() { onClick={deleteAllSubscriptions} className="text-xs py-1 px-2 rounded-full focus:outline-none bg-red-500 hover:bg-red-700 text-white" > - Спри известията на всички мои устройства {subs != "" ? `(${subs})` : ""} + Спри известията на всички мои устройства {_subs != "" ? `(${_subs})` : ""}
{isAdmin && @@ -400,3 +400,13 @@ function PwaManager() { } } export default PwaManager; + +//get server side props - subs count +export const getServerSideProps = async (context) => { + //ToDo: get the number of subscriptions from the database + return { + props: { + subs: 0 + } + } +} diff --git a/components/PwaManagerNotifications.tsx b/components/PwaManagerNotifications.tsx new file mode 100644 index 0000000..cc82dfe --- /dev/null +++ b/components/PwaManagerNotifications.tsx @@ -0,0 +1,132 @@ +import React, { useEffect, useState } from 'react'; +import { useSession } from "next-auth/react"; +import common from '../src/helpers/common'; // Ensure this path is correct +import { set } from 'date-fns'; + +function PwaManagerNotifications() { + const [isPermissionGranted, setIsPermissionGranted] = useState(false); + const [subscription, setSubscription] = useState(null); + const [registration, setRegistration] = useState(null); + const { data: session } = useSession(); + + // Check if all required APIs are supported + const isSupported = () => + 'Notification' in window && + 'serviceWorker' in navigator && + 'PushManager' in window; + + + useEffect(() => { + if (isSupported()) { + requestNotificationPermission(null); + } + + }, []); + + const requestNotificationPermission = async (e) => { + if (e) { + e.preventDefault(); + if (Notification.permission === 'denied') { + console.log('Notification permission denied.'); + alert('Известията са забранени. Моля, разрешете известията от браузъра.'); + } + } + setIsPermissionGranted(Notification.permission === 'granted'); + if (Notification.permission === 'default') { + const permission = await Notification.requestPermission(); + if (permission === 'granted') { + console.log('Notification permission granted.'); + getSubscription(); + } else { + console.log('Notification permission denied.'); + } + } + if (Notification.permission === 'granted') { + getSubscription(); + } + }; + const getSubscription = async () => { + // Handle Push Notification Subscription + if ('serviceWorker' in navigator && 'PushManager' in window) { + navigator.serviceWorker.ready.then(registration => { + registration.pushManager.getSubscription().then(existingSubscription => { + if (existingSubscription) { + console.log('Already subscribed.'); + setSubscription(existingSubscription); + } else if (Notification.permission === "granted") { + // Permission was already granted but no subscription exists, so subscribe now + subscribeToNotifications(registration); + } + }); + }); + } + } + + const subscribeToNotifications = async () => { + const registration = await navigator.serviceWorker.ready; + let vapidPublicKey = process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY; // Ensure this is configured + if (!vapidPublicKey) { + // Fetch the public key from the server if not present in env variables + const response = await fetch('/api/notify', { method: 'GET' }); + const responseData = await response.json(); + vapidPublicKey = responseData.pk; + if (!vapidPublicKey) { + throw new Error("Failed to fetch VAPID public key from server."); + } + } + const convertedVapidKey = common.base64ToUint8Array(vapidPublicKey); + + try { + const subscription = await registration.pushManager.subscribe({ + userVisibleOnly: true, + applicationServerKey: convertedVapidKey + }); + console.log('Subscribed to push notifications:', subscription); + setSubscription(subscription); + sendSubscriptionToServer(subscription); + } catch (error) { + console.error('Failed to subscribe to push notifications:', error); + } + }; + + const sendSubscriptionToServer = async (sub) => { + if (session.user?.id != null) { + await fetch(`/api/notify`, { + method: 'PUT', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ subscription: sub, id: session.user.id }) + }).then(async response => { + if (!response.ok) { + throw new Error('Failed to save subscription data on server.'); + } + else { + console.log('Subscription data saved on server.'); + const s = await response.json(); + setSubscription(sub); + console.log('Web push subscribed!'); + } + }); + } + }; + + + return ( +
+ +
+ ); +} + + +export default PwaManagerNotifications; diff --git a/components/sidebar.tsx b/components/sidebar.tsx index c34c5b9..73ff708 100644 --- a/components/sidebar.tsx +++ b/components/sidebar.tsx @@ -6,6 +6,7 @@ import sidemenu, { footerMenu } from './sidemenuData.js'; // Move sidemenu data import axiosInstance from "src/axiosSecure"; import common from "src/helpers/common"; import LanguageSwitcher from "./languageSwitcher"; +import PwaManagerNotifications from "./PwaManagerNotifications"; import { useTranslations } from 'next-intl'; import { getTranslations } from 'next-intl/server'; import ProtectedPage from "pages/examples/protected"; @@ -203,6 +204,8 @@ function UserDetails({ session }) {

{session.user.name}

{session.user.role}

+ + { e.preventDefault(); signOut(); }}> {/* {t('logout')} */} изход From 4021279fb83b88666739ae61173904218b31644a Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 8 May 2024 16:08:14 +0300 Subject: [PATCH 6/8] setup maintenance container. improve pushman ui --- _deploy/maintenance/default.conf | 11 +++++++++++ _deploy/{maintenance.html => maintenance/index.html} | 0 _deploy/{ => maintenance}/maintenance.yml | 1 + components/PwaManagerNotifications.tsx | 7 ++++--- 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 _deploy/maintenance/default.conf rename _deploy/{maintenance.html => maintenance/index.html} (100%) rename _deploy/{ => maintenance}/maintenance.yml (81%) diff --git a/_deploy/maintenance/default.conf b/_deploy/maintenance/default.conf new file mode 100644 index 0000000..3aa17e6 --- /dev/null +++ b/_deploy/maintenance/default.conf @@ -0,0 +1,11 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } +} diff --git a/_deploy/maintenance.html b/_deploy/maintenance/index.html similarity index 100% rename from _deploy/maintenance.html rename to _deploy/maintenance/index.html diff --git a/_deploy/maintenance.yml b/_deploy/maintenance/maintenance.yml similarity index 81% rename from _deploy/maintenance.yml rename to _deploy/maintenance/maintenance.yml index 1ec55e6..cd36069 100644 --- a/_deploy/maintenance.yml +++ b/_deploy/maintenance/maintenance.yml @@ -5,6 +5,7 @@ services: image: nginx:latest volumes: - /mnt/docker_volumes/maintenance:/usr/share/nginx/html + - /mnt/docker_volumes/maintenance/default.conf:/etc/nginx/conf.d/default.conf ports: - "3010:80" environment: diff --git a/components/PwaManagerNotifications.tsx b/components/PwaManagerNotifications.tsx index cc82dfe..fd5fc6f 100644 --- a/components/PwaManagerNotifications.tsx +++ b/components/PwaManagerNotifications.tsx @@ -117,12 +117,13 @@ function PwaManagerNotifications() {
); From 5816838bbe9406f4c456257a8e9e071dbe33cc47 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 8 May 2024 16:29:49 +0300 Subject: [PATCH 7/8] try to fix rediirect issues --- src/axiosSecure.js | 1 - src/axiosServer.js | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/axiosSecure.js b/src/axiosSecure.js index 75bcabc..5c14060 100644 --- a/src/axiosSecure.js +++ b/src/axiosSecure.js @@ -24,7 +24,6 @@ applyAuthTokenInterceptor(axiosInstance, { requestRefresh }); // Notice that th // 4. Logging in const login = async (params) => { const response = await axiosInstance.post('/api/auth/signin', params) - // save tokens to storage setAuthTokens({ accessToken: response.data.access_token, diff --git a/src/axiosServer.js b/src/axiosServer.js index 77faaeb..742a8ec 100644 --- a/src/axiosServer.js +++ b/src/axiosServer.js @@ -31,7 +31,8 @@ const axiosServer = async (context) => { } else { //redirect to next-auth login page - context.res.writeHead(302, { Location: encodeURIComponent('/api/auth/signin') }); + //context.res.writeHead(302, { Location: encodeURIComponent('/api/auth/signin') }); + context.res.end(); return { props: {} }; } From bcc5b9fa0f4408bdbf97e71e35b7f816cbe6e355 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 8 May 2024 18:12:59 +0300 Subject: [PATCH 8/8] Revert "protect some common pages" This reverts commit 48f46ec9fe683c0befdd19f5bc5654c327133bed. --- pages/contactUs.tsx | 26 ++++++------ pages/feedback.tsx | 9 ++--- pages/guidelines.tsx | 96 +++++++++++++++++++++----------------------- pages/permits.tsx | 89 ++++++++++++++++++++-------------------- 4 files changed, 104 insertions(+), 116 deletions(-) diff --git a/pages/contactUs.tsx b/pages/contactUs.tsx index 890a552..b29af89 100644 --- a/pages/contactUs.tsx +++ b/pages/contactUs.tsx @@ -2,22 +2,20 @@ import React from 'react'; import Layout from "../components/layout"; import FeedbackForm from "../components/reports/FeedbackForm"; import { useTranslations } from 'next-intl'; -import ProtectedRoute from "../components/protectedRoute"; const ContactsPage = () => { const t = useTranslations('common'); return ( - -
-

{t('appNameLong') - t('contacts')}

-
-
Електронна поща: specialnosvidetelstvanesofia@gmail.com
+
+

{t('appNameLong') - t('contacts')}

+ +
Електронна поща: specialnosvidetelstvanesofia@gmail.com
- {/* - +
+ ); }; diff --git a/pages/feedback.tsx b/pages/feedback.tsx index 23909a8..da89509 100644 --- a/pages/feedback.tsx +++ b/pages/feedback.tsx @@ -1,16 +1,13 @@ import React from 'react'; import Layout from "../components/layout"; import FeedbackForm from "../components/reports/FeedbackForm"; -import ProtectedRoute from "../components/protectedRoute"; const ContactsPage = () => { return ( - -
- -
-
+
+ +
); }; diff --git a/pages/guidelines.tsx b/pages/guidelines.tsx index d7f394b..64abc8b 100644 --- a/pages/guidelines.tsx +++ b/pages/guidelines.tsx @@ -1,6 +1,5 @@ import React, { useState } from 'react'; import Layout from "../components/layout"; -import ProtectedRoute from "../components/protectedRoute"; const PDFViewerPage = () => { const [language, setLanguage] = useState('bg'); // default language is Bulgarian @@ -26,64 +25,61 @@ const PDFViewerPage = () => { }; return ( - - - -

Напътствия

-
-

Важни напътствия за службата

-
    -
  1. Покани за Възпоменанието: За кампанията ще използваме покани без конкретен адрес. Ще насочваме хората към най-близкото за тях място, чрез сайта или като попълним поканата.
  2. + +

    Напътствия

    +
    +

    Важни напътствия за службата

    +
      +
    1. Покани за Възпоменанието: За кампанията ще използваме покани без конкретен адрес. Ще насочваме хората към най-близкото за тях място, чрез сайта или като попълним поканата.
    2. -
    3. Щандове: Предлагаме следното: -
        -
      • Да има известно разстояние между нас и щандовете. Целта е да оставим хората свободно да се доближат до количките и ако някой прояви интерес може да се приближим.
      • -
      • Когато сме двама или трима може да стоим заедно. Ако сме четирима би било хубаво да се разделим по двама на количка и количките да са на известно разстояние една от друга.
      • -
      -
    4. -
    5. Безопасност: Нека се страем зад нас винаги да има защита или препятствие за недобронамерени хора.
    6. -
    7. Плакати: Моля при придвижване на количките да слагате плакатите така, че илюстрацията да се вижда, когато калъфа е сложен. Целта е снимките да не се търкат в количката, защото се повреждат.
    8. -
    9. Литература: При проявен интерес на чужд език, използвайте списанията и трактатите на други езици в папките.
    10. -
    11. График: Моля да ни изпратите вашите предпочитания до 23-то число на месеца като използвате меню Възможности
    12. -
    13. Случки: Ако сте имали хубави случки на количките, моля пишете ни.
    14. -
    +
  3. Щандове: Предлагаме следното: +
      +
    • Да има известно разстояние между нас и щандовете. Целта е да оставим хората свободно да се доближат до количките и ако някой прояви интерес може да се приближим.
    • +
    • Когато сме двама или трима може да стоим заедно. Ако сме четирима би било хубаво да се разделим по двама на количка и количките да са на известно разстояние една от друга.
    • +
    +
  4. +
  5. Безопасност: Нека се страем зад нас винаги да има защита или препятствие за недобронамерени хора.
  6. +
  7. Плакати: Моля при придвижване на количките да слагате плакатите така, че илюстрацията да се вижда, когато калъфа е сложен. Целта е снимките да не се търкат в количката, защото се повреждат.
  8. +
  9. Литература: При проявен интерес на чужд език, използвайте списанията и трактатите на други езици в папките.
  10. +
  11. График: Моля да ни изпратите вашите предпочитания до 23-то число на месеца като използвате меню Възможности
  12. +
  13. Случки: Ако сте имали хубави случки на количките, моля пишете ни.
  14. +
+
+ +
{/* Adjust the 100px based on your header/footer size */} +
+ {languages.map((lang, index) => ( + + {index > 0 &&
} {/* Vertical line separator */} + +
+ ))}
+

+ + Свали Напътствията + +

-
{/* Adjust the 100px based on your header/footer size */} -
- {languages.map((lang, index) => ( - - {index > 0 &&
} {/* Vertical line separator */} - -
- ))} -
-

- - Свали Напътствията - -

- -
- - {/* +
+ + {/*

Your browser does not support PDFs. Please download the PDF to view it: Свали PDF файла.

Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: Свали PDF файла.

*/} -
- {/* */} - - - - + {/* */} + + + + ); }; diff --git a/pages/permits.tsx b/pages/permits.tsx index 6175782..07bdf33 100644 --- a/pages/permits.tsx +++ b/pages/permits.tsx @@ -3,7 +3,7 @@ import Layout from "../components/layout"; import fs from 'fs'; import path from 'path'; import { url } from 'inspector'; -import ProtectedRoute from "../components/protectedRoute"; +import ProtectedRoute, { serverSideAuth } from "/components/protectedRoute"; import axiosInstance from '../src/axiosSecure'; import { UserRole } from "@prisma/client"; @@ -48,59 +48,56 @@ const PDFViewerPage = ({ pdfFiles }) => { return ( - -

Разрешителни

- -
-
-

За да качите файл кликнете на бутона по-долу и изберете файл от вашия компютър.

- Разрешителни + +
+
+

За да качите файл кликнете на бутона по-долу и изберете файл от вашия компютър.

+ -
-
-

Съществуващи файлове:

- {files.length > 0 ? ( - files.map((file, index) => ( -
- - {file.name} - - -
- )) - ) : ( -

Няма качени файлове.

- )} -
- -
- -
{/* Adjust the 100px based on your header/footer size */} - {pdfFiles.map((file, index) => ( - <>

- - Свали: {file.name} - -

-
- < object data={file.url} type="application/pdf" style={{ width: '100%', height: '100%' }}> -

Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: Свали {file.name}.

-

Your browser does not support PDFs. Please download the PDF to view it: {file.name}.

-
-
- - ))} +
+

Съществуващи файлове:

+ {files.length > 0 ? ( + files.map((file, index) => ( +
+ + {file.name} + + +
+ )) + ) : ( +

Няма качени файлове.

+ )} +
- - + + +
{/* Adjust the 100px based on your header/footer size */} + {pdfFiles.map((file, index) => ( + <>

+ + Свали: {file.name} + +

+
+ < object data={file.url} type="application/pdf" style={{ width: '100%', height: '100%' }}> +

Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: Свали {file.name}.

+

Your browser does not support PDFs. Please download the PDF to view it: {file.name}.

+ +
+ + ))} +
+ ); };