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": "Участници",
"feedback": "Отзиви",
"contactUs": "За връзка",
"admin": "Администрация",
"admin": "Админ",
"cart-places": "Места",
"cart-publishers": "Вестители",
"cart-events": "План",

View File

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

View File

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

View File

@ -1,11 +1,13 @@
import { useSession } from "next-auth/react"
import { useRouter } from 'next/router';
import React, { useState, useEffect } from 'react';
import Layout from "../components/layout"
import AvCalendar from '../components/calendar/avcalendar';
import { getSession } from "next-auth/react";
import common from '../src/helpers/common';
import { Availability, UserRole } from "@prisma/client";
import ProtectedRoute, { serverSideAuth } from "../components/protectedRoute";
import React, { useState, useEffect } from 'react';
import axiosInstance from '../src/axiosSecure';
// const dataHelper = require('../../src/helpers/data');
import dataHelper from '../src/helpers/data';
@ -24,7 +26,10 @@ interface IProps {
cartEvents: any;
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 [userName, setUserName] = useState(session?.user?.name);
const [userId, setUserId] = useState(initialUserId);
@ -45,6 +50,17 @@ export default function IndexPage({ initialItems, initialUserId, cartEvents, las
}
}, [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) => {
if (!publisher || publisher.id === undefined) return;
console.log("selecting publisher", publisher.id);

View File

@ -17,12 +17,16 @@ export default function IndexPage() {
useEffect(() => {
// Redirect to /dash if user is logged in
if (session) {
router.push('/dash');
router.push('/dash?newLogin=true');
}
}, [session, router]);
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) {