simple welcome message for all

This commit is contained in:
Dobromir Popov
2024-05-18 11:41:05 +03:00
parent dcf42df20b
commit 9889651764
5 changed files with 33 additions and 9 deletions

View File

@ -23,7 +23,7 @@
"contactAll": "Участници", "contactAll": "Участници",
"feedback": "Отзиви", "feedback": "Отзиви",
"contactUs": "За връзка", "contactUs": "За връзка",
"admin": "Администрация", "admin": "Админ",
"cart-places": "Места", "cart-places": "Места",
"cart-publishers": "Вестители", "cart-publishers": "Вестители",
"cart-events": "План", "cart-events": "План",

View File

@ -1,5 +1,7 @@
{ {
"common": { "common": {
"appNameLong": "Специално свидетелстване на обществени места в София",
"contacts": "Контакти",
"greeting": "Hello", "greeting": "Hello",
"farewell": "Goodbye", "farewell": "Goodbye",
"changeTo": "Change to", "changeTo": "Change to",

View File

@ -1,13 +1,15 @@
{ {
"common": { "common": {
"appNameLong": "Специално свидетелстване на обществени места в София",
"contacts": "Контакти",
"greeting": "Здравей", "greeting": "Здравей",
"farewell": "Довиждане", "farewell": "Довиждане",
"changeTo": "Смени на", "changeTo": "Смени на",
"BG": "[RU] Български", "BG": "болгарский",
"EN": "[RU] Английски", "EN": "английский",
"RU": "[RU] Руски", "RU": "русский",
"login": "вход", "login": "вход",
"contacts": "Контакти" "contacts": "Контакти te"
}, },
"menu": { "menu": {
"dashboard": "Начало" "dashboard": "Начало"

View File

@ -1,11 +1,13 @@
import { useSession } from "next-auth/react" import { useSession } from "next-auth/react"
import { useRouter } from 'next/router';
import React, { useState, useEffect } from 'react';
import Layout from "../components/layout" import Layout from "../components/layout"
import AvCalendar from '../components/calendar/avcalendar'; import AvCalendar from '../components/calendar/avcalendar';
import { getSession } from "next-auth/react"; import { getSession } from "next-auth/react";
import common from '../src/helpers/common'; import common from '../src/helpers/common';
import { Availability, UserRole } from "@prisma/client"; import { Availability, UserRole } from "@prisma/client";
import ProtectedRoute, { serverSideAuth } from "../components/protectedRoute"; import ProtectedRoute, { serverSideAuth } from "../components/protectedRoute";
import React, { useState, useEffect } from 'react';
import axiosInstance from '../src/axiosSecure'; import axiosInstance from '../src/axiosSecure';
// const dataHelper = require('../../src/helpers/data'); // const dataHelper = require('../../src/helpers/data');
import dataHelper from '../src/helpers/data'; import dataHelper from '../src/helpers/data';
@ -24,7 +26,10 @@ interface IProps {
cartEvents: any; cartEvents: any;
lastPublishedDate: Date; lastPublishedDate: Date;
} }
export default function IndexPage({ initialItems, initialUserId, cartEvents, lastPublishedDate }: IProps) { export default function DashboardPage({ initialItems, initialUserId, cartEvents, lastPublishedDate }: IProps) {
const router = useRouter();
const { newLogin } = router.query;
const { data: session } = useSession(); const { data: session } = useSession();
const [userName, setUserName] = useState(session?.user?.name); const [userName, setUserName] = useState(session?.user?.name);
const [userId, setUserId] = useState(initialUserId); const [userId, setUserId] = useState(initialUserId);
@ -45,6 +50,17 @@ export default function IndexPage({ initialItems, initialUserId, cartEvents, las
} }
}, [session]); }, [session]);
//const [notificationsVisible, setNotificationsVisible] = useState(false);
useEffect(() => {
if (newLogin === 'true') {
alert("Мили бртя, искаме само да ви напомним да ни изпратите вашите предпочитания за юни до 25-то число като използвате меню 'Възможности'. Ако имате проблем, моля пишете ни на 'specialnosvidetelstvanesofia@gmail.com'");
const currentPath = router.pathname;
router.replace(currentPath, undefined, { shallow: true }); // Removes the query without affecting the history
}
}, [newLogin]);
const handleUserSelection = async (publisher) => { const handleUserSelection = async (publisher) => {
if (!publisher || publisher.id === undefined) return; if (!publisher || publisher.id === undefined) return;
console.log("selecting publisher", publisher.id); console.log("selecting publisher", publisher.id);

View File

@ -17,12 +17,16 @@ export default function IndexPage() {
useEffect(() => { useEffect(() => {
// Redirect to /dash if user is logged in // Redirect to /dash if user is logged in
if (session) { if (session) {
router.push('/dash'); router.push('/dash?newLogin=true');
} }
}, [session, router]); }, [session, router]);
if (status === "loading") { if (status === "loading") {
return <p>Loading...</p>; // Or any other loading state return (
<div className="flex justify-center items-center h-screen">
<p className="text-lg font-medium">Loading...</p>
</div>
);
} }
if (session) { if (session) {