diff --git a/.env b/.env index 6f394dd..0bcbad3 100644 --- a/.env +++ b/.env @@ -4,5 +4,5 @@ NEXT_PUBLIC_IDP_AuthorizeEndpoint = $NEXT_PUBLIC_COGNITO_URL/oauth2/authorize NEXT_PUBLIC_IDP_Tokendpoint = $NEXT_PUBLIC_COGNITO_URL/oauth2/token NEXT_PUBLIC_QUEMISTRY_DOMAIN =https://dkraju438qs82.cloudfront.net NEXT_PUBLIC_RedirectUrl = $NEXT_PUBLIC_QUEMISTRY_DOMAIN/auth/google -NEXT_PUBLIC_QUEMISTRY_GATEWAY_URL=http://localhost:8080 +NEXT_PUBLIC_QUEMISTRY_GATEWAY_URL=http://localhost:80 NEXT_PUBLIC_QUEMISTRY_AUTH_URL = $NEXT_PUBLIC_QUEMISTRY_GATEWAY_URL/v1/auth \ No newline at end of file diff --git a/app/(full-page)/auth/google/page.tsx b/app/(full-page)/auth/google/page.tsx index 6bd952f..8d211e8 100644 --- a/app/(full-page)/auth/google/page.tsx +++ b/app/(full-page)/auth/google/page.tsx @@ -5,7 +5,6 @@ import { useCookies} from 'react-cookie' import { redirect } from 'next/navigation' import { GoogleSigninService } from '@/service/GoogleSignInService' import { useContext , useEffect, useState } from 'react' -import { IS_LOGIN } from '../../../../lib/constants' import { LayoutContext } from '../../../../layout/context/layoutcontext'; import { classNames } from 'primereact/utils'; import { Button } from 'primereact/button'; @@ -45,7 +44,6 @@ const GoogleAuthPage = () => { //clear cookies removeCookie('state'); removeCookie('code_verifier'); - localStorage.setItem(IS_LOGIN, "true" ); setIsLogin(true); }) .catch((err) => { diff --git a/app/(full-page)/page.tsx b/app/(full-page)/page.tsx index 6aa2e9d..2726763 100644 --- a/app/(full-page)/page.tsx +++ b/app/(full-page)/page.tsx @@ -10,12 +10,10 @@ import { Divider } from 'primereact/divider'; import { LayoutContext } from '../../layout/context/layoutcontext'; import { NodeRef } from '@/types'; import { classNames } from 'primereact/utils'; -import { Dialog } from 'primereact/dialog'; const LandingPage = () => { const [isHidden, setIsHidden] = useState(false); const { layoutConfig } = useContext(LayoutContext); - const [showSignIn, setShowSignIn] = useState(false); const menuRef = useRef(null); @@ -48,18 +46,6 @@ const LandingPage = () => { -
  • - - Highlights - - -
  • -
  • - - Pricing - - -
  • diff --git a/app/(main)/dashboard/page.tsx b/app/(main)/dashboard/page.tsx index a06710d..0a8db4a 100644 --- a/app/(main)/dashboard/page.tsx +++ b/app/(main)/dashboard/page.tsx @@ -130,261 +130,35 @@ const Dashboard = () => {
    - Orders + Questions Attempted
    152
    -
    - -
    24 new since last visit
    -
    -
    -
    -
    - Revenue -
    $2.100
    -
    -
    - -
    -
    - %52+ - since last week -
    -
    -
    -
    -
    -
    - Customers -
    28441
    -
    -
    - -
    -
    - 520 - newly registered -
    -
    Comments -
    152 Unread
    +
    5 Unread
    - 85 + 10 responded
    -
    Recent Sales
    - - {data.image}} /> - - formatCurrency(data.price)} /> - ( - <> -
    -
    -
    -
    Best Selling Products
    -
    -
    -
    -
      -
    • -
      - Space T-Shirt -
      Clothing
      -
      -
      -
      -
      -
      - %50 -
      -
    • -
    • -
      - Portal Sticker -
      Accessories
      -
      -
      -
      -
      -
      - %16 -
      -
    • -
    • -
      - Supernova Sticker -
      Accessories
      -
      -
      -
      -
      -
      - %67 -
      -
    • -
    • -
      - Wonders Notebook -
      Office
      -
      -
      -
      -
      -
      - %35 -
      -
    • -
    • -
      - Mat Black Case -
      Accessories
      -
      -
      -
      -
      -
      - %75 -
      -
    • -
    • -
      - Robots T-Shirt -
      Clothing
      -
      -
      -
      -
      -
      - %40 -
      -
    • -
    -
    -
    - -
    -
    -
    Sales Overview
    +
    Progress
    - -
    -
    -
    Notifications
    -
    -
    -
    - - TODAY -
      -
    • -
      - -
      - - Richard Jones - - {' '} - has purchased a blue t-shirt for 79$ - - -
    • -
    • -
      - -
      - - Your request for withdrawal of 2500$ has been initiated. - -
    • -
    - - YESTERDAY -
      -
    • -
      - -
      - - Keyser Wick - - {' '} - has purchased a black jacket for 59$ - - -
    • -
    • -
      - -
      - - Jane Davis - has posted a new questions about your product. - -
    • -
    -
    -
    -
    -
    TAKE THE NEXT STEP
    -
    Try PrimeBlocks
    -
    -
    - - Get Started - -
    -
    ); diff --git a/layout/AppMenu.tsx b/layout/AppMenu.tsx index a527dfa..a3d65b4 100644 --- a/layout/AppMenu.tsx +++ b/layout/AppMenu.tsx @@ -4,7 +4,6 @@ import React, { Suspense, useContext } from 'react'; import AppMenuitem from './AppMenuitem'; import { LayoutContext } from './context/layoutcontext'; import { MenuProvider } from './context/menucontext'; -import Link from 'next/link'; import { AppMenuItem } from '@/types'; const AppMenu = () => { @@ -24,7 +23,7 @@ const AppMenu = () => { items: [{ label: 'Questions', icon: 'pi pi-fw pi-tag', to: '/questions/searchlist' }, { label: 'Topics', icon: 'pi pi-fw pi-tag', to: '/questions/topics' }] }, - { +/* { label: 'UI Components', items: [ { label: 'Form Layout', icon: 'pi pi-fw pi-id-card', to: '/uikit/formlayout' }, @@ -177,7 +176,7 @@ const AppMenu = () => { target: '_blank' } ] - } + }*/ ]; return ( diff --git a/layout/AppTopbar.tsx b/layout/AppTopbar.tsx index 88803d6..4b47e5a 100644 --- a/layout/AppTopbar.tsx +++ b/layout/AppTopbar.tsx @@ -2,11 +2,13 @@ import Link from 'next/link'; import { classNames } from 'primereact/utils'; -import React, { forwardRef, useContext, useImperativeHandle, useRef } from 'react'; +import React, { forwardRef, useContext, useEffect, useImperativeHandle, useRef, useState } from 'react'; import { AppTopbarRef } from '@/types'; import { LayoutContext } from './context/layoutcontext'; import { IS_LOGIN } from "../lib/constants" import { Menu } from 'primereact/menu'; +import { GoogleSigninService } from '@/service/GoogleSignInService' +import { redirect } from 'next/navigation' const AppTopbar = forwardRef((props, ref) => { const { layoutConfig, layoutState, onMenuToggle, showProfileSidebar } = useContext(LayoutContext); @@ -14,6 +16,13 @@ const AppTopbar = forwardRef((props, ref) => { const topbarmenuRef = useRef(null); const topbarmenubuttonRef = useRef(null); const profilemenubuttonRef = useRef(null); + const [isLogin, setIsLogin] = useState(localStorage == undefined || localStorage.getItem(IS_LOGIN) === "true"); + + // useEffect(()=>{ + // if(!isLogin){ + // redirect("/"); + // } + // },[isLogin]); useImperativeHandle(ref, () => ({ menubutton: menubuttonRef.current, @@ -34,7 +43,17 @@ const AppTopbar = forwardRef((props, ref) => { }, { label: 'Sign out', - icon: 'pi pi-sign-out' + icon: 'pi pi-sign-out', + command: ()=> { + GoogleSigninService.signOut() + .then(()=>{ + setIsLogin(false); + }) + .catch((err)=>{ + console.log("fail to logout."); + console.log(err); + }); + } } ]; @@ -54,17 +73,17 @@ const AppTopbar = forwardRef((props, ref) => {
    - {localStorage.getItem(IS_LOGIN) === "true" || + } - {localStorage.getItem(IS_LOGIN) !== "true" || } - {localStorage.getItem(IS_LOGIN) !== "true" || + {!isLogin ||