Revert "protect some common pages"

This reverts commit 48f46ec9fe.
This commit is contained in:
Dobromir Popov
2024-05-08 18:12:59 +03:00
parent 48f46ec9fe
commit bcc5b9fa0f
4 changed files with 104 additions and 116 deletions

View File

@ -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 (
<Layout>
<ProtectedRoute>
<div className="mx-auto my-8 p-6 max-w-4xl bg-white rounded-lg shadow-md">
<h1 className="text-2xl font-bold text-gray-800 mb-4">{t('appNameLong') - t('contacts')}</h1>
<ul className="list-disc pl-5">
<li className="text-gray-700 mb-2">Янко Ванчев - <a href="tel:+359878224467" className="text-blue-500 hover:text-blue-600">+359 878 22 44 67</a></li>
<li className="text-gray-700">Крейг Смит - <a href="tel:+359878994573" className="text-blue-500 hover:text-blue-600">+359 878 994 573</a></li>
</ul>
<div className="text-gray-700 pl-4 py-5">Електронна поща: <a href="mailto:specialnosvidetelstvanesofia@gmail.com" className="text-blue-500 hover:text-blue-600">specialnosvidetelstvanesofia@gmail.com</a></div>
<div className="mx-auto my-8 p-6 max-w-4xl bg-white rounded-lg shadow-md">
<h1 className="text-2xl font-bold text-gray-800 mb-4">{t('appNameLong') - t('contacts')}</h1>
<ul className="list-disc pl-5">
<li className="text-gray-700 mb-2">Янко Ванчев - <a href="tel:+359878224467" className="text-blue-500 hover:text-blue-600">+359 878 22 44 67</a></li>
<li className="text-gray-700">Крейг Смит - <a href="tel:+359878994573" className="text-blue-500 hover:text-blue-600">+359 878 994 573</a></li>
</ul>
<div className="text-gray-700 pl-4 py-5">Електронна поща: <a href="mailto:specialnosvidetelstvanesofia@gmail.com" className="text-blue-500 hover:text-blue-600">specialnosvidetelstvanesofia@gmail.com</a></div>
{/* <div className="mt-6">
{/* <div className="mt-6">
<h3 className="text-lg font-semibold text-gray-800 mb-3">Социални мрежи</h3>
<div className="flex space-x-4">
<a href="#" className="text-blue-500 hover:text-blue-600">
@ -27,13 +25,13 @@ const ContactsPage = () => {
</a>
</div>
</div > */
}
{/* <a href="https://t.me/mwHitnessing_bot" className="inline-flex items-center ml-4" target="_blank">
}
{/* <a href="https://t.me/mwHitnessing_bot" className="inline-flex items-center ml-4" target="_blank">
<img src="styles/icons/telegram-svgrepo-com.svg" alt="Телеграм" width="32" height="32" className="align-middle" />
<span className="align-middle">Телеграм</span>
</a> */}
</div >
</ProtectedRoute>
</div >
</Layout >
);
};

View File

@ -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 (
<Layout>
<ProtectedRoute>
<div className="h-5/6 grid place-items-center">
<FeedbackForm />
</div>
</ProtectedRoute>
<div className="h-5/6 grid place-items-center">
<FeedbackForm />
</div>
</Layout >
);
};

View File

@ -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 (
<Layout>
<ProtectedRoute>
<script src="https://mozilla.github.io/pdf.js/dist/pdf.js"></script>
<h1 className="text-3xl font-bold">Напътствия</h1>
<div className="guidelines-section mb-5 p-4 bg-gray-100 rounded-lg">
<h2 className="text-2xl font-semibold mb-3">Важни напътствия за службата</h2>
<ol className="list-decimal list-inside">
<li><strong>Покани за Възпоменанието:</strong> За кампанията ще използваме покани без конкретен адрес. Ще насочваме хората към най-близкото за тях място, чрез сайта или като попълним поканата.</li>
<Layout><script src="https://mozilla.github.io/pdf.js/dist/pdf.js"></script>
<h1 className="text-3xl font-bold">Напътствия</h1>
<div className="guidelines-section mb-5 p-4 bg-gray-100 rounded-lg">
<h2 className="text-2xl font-semibold mb-3">Важни напътствия за службата</h2>
<ol className="list-decimal list-inside">
<li><strong>Покани за Възпоменанието:</strong> За кампанията ще използваме покани без конкретен адрес. Ще насочваме хората към най-близкото за тях място, чрез сайта или като попълним поканата.</li>
<li><strong>Щандове:</strong> Предлагаме следното:
<ul className="list-disc list-inside ml-4">
<li>Да има известно разстояние между нас и щандовете. Целта е да оставим хората свободно да се доближат до количките и ако някой прояви интерес може да се приближим.</li>
<li>Когато сме двама или трима може да стоим заедно. Ако сме четирима би било хубаво да се разделим по двама на количка и количките да са на известно разстояние една от друга.</li>
</ul>
</li>
<li><strong>Безопасност:</strong> Нека се страем зад нас винаги да има защита или препятствие за недобронамерени хора.</li>
<li><strong>Плакати:</strong> Моля при придвижване на количките да слагате плакатите така, че илюстрацията да се вижда, когато калъфа е сложен. Целта е снимките да не се търкат в количката, защото се повреждат.</li>
<li><strong>Литература:</strong> При проявен интерес на чужд език, използвайте списанията и трактатите на други езици в папките.</li>
<li><strong>График:</strong> Моля да ни изпратите вашите предпочитания до 23-то число на месеца като използвате меню <a href='/dash'> Възможности</a></li>
<li><strong>Случки:</strong> Ако сте имали хубави случки на количките, моля пишете ни.</li>
</ol>
<li><strong>Щандове:</strong> Предлагаме следното:
<ul className="list-disc list-inside ml-4">
<li>Да има известно разстояние между нас и щандовете. Целта е да оставим хората свободно да се доближат до количките и ако някой прояви интерес може да се приближим.</li>
<li>Когато сме двама или трима може да стоим заедно. Ако сме четирима би било хубаво да се разделим по двама на количка и количките да са на известно разстояние една от друга.</li>
</ul>
</li>
<li><strong>Безопасност:</strong> Нека се страем зад нас винаги да има защита или препятствие за недобронамерени хора.</li>
<li><strong>Плакати:</strong> Моля при придвижване на количките да слагате плакатите така, че илюстрацията да се вижда, когато калъфа е сложен. Целта е снимките да не се търкат в количката, защото се повреждат.</li>
<li><strong>Литература:</strong> При проявен интерес на чужд език, използвайте списанията и трактатите на други езици в папките.</li>
<li><strong>График:</strong> Моля да ни изпратите вашите предпочитания до 23-то число на месеца като използвате меню <a href='/dash'> Възможности</a></li>
<li><strong>Случки:</strong> Ако сте имали хубави случки на количките, моля пишете ни.</li>
</ol>
</div>
<div style={{ width: '100%', height: 'calc(100vh - 100px)' }}> {/* Adjust the 100px based on your header/footer size */}
<div className="my-4 flex items-center">
{languages.map((lang, index) => (
<React.Fragment key={lang.code}>
{index > 0 && <div className="bg-gray-400 w-px h-6"></div>} {/* Vertical line separator */}
<button
onClick={() => setLanguage(lang.code)}
className={`text-lg py-2 px-4 ${language === lang.code ? 'bg-blue-500 text-white' : 'bg-gray-200 text-gray-800 hover:bg-blue-500 hover:text-white'} ${index === 0 ? 'rounded-l-full' : index === languages.length - 1 ? 'rounded-r-full' : ''}`}
>
{lang.label}
</button>
</React.Fragment>
))}
</div>
<p className="p-2 pb-5">
<a href={pdfFile} className="text-blue-600 hover:text-blue-800 visited:text-purple-600 underline" target='_blank'>
Свали Напътствията
</a>
</p>
<div style={{ width: '100%', height: 'calc(100vh - 100px)' }}> {/* Adjust the 100px based on your header/footer size */}
<div className="my-4 flex items-center">
{languages.map((lang, index) => (
<React.Fragment key={lang.code}>
{index > 0 && <div className="bg-gray-400 w-px h-6"></div>} {/* Vertical line separator */}
<button
onClick={() => setLanguage(lang.code)}
className={`text-lg py-2 px-4 ${language === lang.code ? 'bg-blue-500 text-white' : 'bg-gray-200 text-gray-800 hover:bg-blue-500 hover:text-white'} ${index === 0 ? 'rounded-l-full' : index === languages.length - 1 ? 'rounded-r-full' : ''}`}
>
{lang.label}
</button>
</React.Fragment>
))}
</div>
<p className="p-2 pb-5">
<a href={pdfFile} className="text-blue-600 hover:text-blue-800 visited:text-purple-600 underline" target='_blank'>
Свали Напътствията
</a>
</p>
<div style={{ width: 'calc(100% - 1rem)', height: '100%', margin: '0 0' }}>
<embed src={pdfFile} type="application/pdf" style={{ width: '100%', height: '100%' }} />
{/* <object data={pdfFile} type="application/pdf" page="2" style={{ width: '100%', height: '100%' }}>
<div style={{ width: 'calc(100% - 1rem)', height: '100%', margin: '0 0' }}>
<embed src={pdfFile} type="application/pdf" style={{ width: '100%', height: '100%' }} />
{/* <object data={pdfFile} type="application/pdf" page="2" style={{ width: '100%', height: '100%' }}>
<p>Your browser does not support PDFs. Please download the PDF to view it: <a href={pdfFile}>Свали PDF файла</a>.</p>
<p>Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: <a href={pdfFile}>Свали PDF файла</a>.</p>
</object> */}
</div>
{/* <iframe src={`https://docs.google.com/gview?url=${baseUrl}${pdfFile}&embedded=true`} style={{ width: '100%', height: '100%' }} frameBorder="0"></iframe> */}
</div>
</ProtectedRoute>
</Layout>
{/* <iframe src={`https://docs.google.com/gview?url=${baseUrl}${pdfFile}&embedded=true`} style={{ width: '100%', height: '100%' }} frameBorder="0"></iframe> */}
</div>
</Layout >
);
};

View File

@ -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 (
<Layout>
<ProtectedRoute>
<h1 className="text-3xl font-bold p-4 pt-8">Разрешителни</h1>
<ProtectedRoute allowedRoles={[UserRole.ADMIN]} deniedMessage="">
<div className="border border-blue-500 p-4 rounded shadow-md">
<div className="mb-6">
<p className="text-lg mb-2">За да качите файл кликнете на бутона по-долу и изберете файл от вашия компютър.</p>
<input type="file" onChange={handleFileUpload} className="block w-full text-sm text-gray-600
<h1 className="text-3xl font-bold p-4 pt-8">Разрешителни</h1>
<ProtectedRoute allowedRoles={[UserRole.ADMIN]} deniedMessage="">
<div className="border border-blue-500 p-4 rounded shadow-md">
<div className="mb-6">
<p className="text-lg mb-2">За да качите файл кликнете на бутона по-долу и изберете файл от вашия компютър.</p>
<input type="file" onChange={handleFileUpload} className="block w-full text-sm text-gray-600
file:mr-4 file:py-2 file:px-4
file:border-0
file:text-sm file:font-semibold
file:bg-blue-500 file:text-white
hover:file:bg-blue-600"/>
</div>
<div>
<h3 className="text-lg font-semibold mb-2">Съществуващи файлове:</h3>
{files.length > 0 ? (
files.map((file, index) => (
<div key={index} className="flex items-center justify-between mb-2 p-2 hover:bg-blue-50 rounded">
<a href={file.url} className="text-blue-600 hover:text-blue-800 visited:text-purple-600 underline" target="_blank" rel="noopener noreferrer">
{file.name}
</a>
<button onClick={() => handleFileDelete(file.name)} className="ml-4 bg-red-500 hover:bg-red-700 text-white font-bold py-1 px-2 rounded focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-opacity-50">
изтрий
</button>
</div>
))
) : (
<p className="text-gray-500">Няма качени файлове.</p>
)}
</div>
</div>
</ProtectedRoute>
<div style={{ width: '100%', height: 'calc(100vh - 100px)' }}> {/* Adjust the 100px based on your header/footer size */}
{pdfFiles.map((file, index) => (
<> <p className="pt-2">
<a href={file.url} className="text-blue-600 hover:text-blue-800 visited:text-purple-600 underline" target='_blank'>
Свали: {file.name}
</a>
</p>
<div style={{ width: 'calc(100% - 1rem)', height: '100%' }} className='py-2'>
< object data={file.url} type="application/pdf" style={{ width: '100%', height: '100%' }}>
<p>Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: <a href={file.url}>Свали {file.name}</a>.</p>
<p>Your browser does not support PDFs. Please download the PDF to view it: <a href={file.url}> {file.name}</a>.</p>
</object>
</div>
</>
))}
<div>
<h3 className="text-lg font-semibold mb-2">Съществуващи файлове:</h3>
{files.length > 0 ? (
files.map((file, index) => (
<div key={index} className="flex items-center justify-between mb-2 p-2 hover:bg-blue-50 rounded">
<a href={file.url} className="text-blue-600 hover:text-blue-800 visited:text-purple-600 underline" target="_blank" rel="noopener noreferrer">
{file.name}
</a>
<button onClick={() => handleFileDelete(file.name)} className="ml-4 bg-red-500 hover:bg-red-700 text-white font-bold py-1 px-2 rounded focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-opacity-50">
изтрий
</button>
</div>
))
) : (
<p className="text-gray-500">Няма качени файлове.</p>
)}
</div>
</div>
</ProtectedRoute>
</Layout >
</ProtectedRoute>
<div style={{ width: '100%', height: 'calc(100vh - 100px)' }}> {/* Adjust the 100px based on your header/footer size */}
{pdfFiles.map((file, index) => (
<> <p className="pt-2">
<a href={file.url} className="text-blue-600 hover:text-blue-800 visited:text-purple-600 underline" target='_blank'>
Свали: {file.name}
</a>
</p>
<div style={{ width: 'calc(100% - 1rem)', height: '100%' }} className='py-2'>
< object data={file.url} type="application/pdf" style={{ width: '100%', height: '100%' }}>
<p>Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: <a href={file.url}>Свали {file.name}</a>.</p>
<p>Your browser does not support PDFs. Please download the PDF to view it: <a href={file.url}> {file.name}</a>.</p>
</object>
</div>
</>
))}
</div>
</Layout >
);
};