fix:after login flow, feedback ui

This commit is contained in:
Rama Priyanto 2025-05-27 12:36:19 +07:00
commit 6d21679cb6
3 changed files with 24 additions and 6 deletions

View File

@ -1,6 +1,6 @@
"use client"; "use client";
import { Input } from "@heroui/input"; import { Input } from "@heroui/input";
import React, { useState } from "react"; import React, { useEffect, useState } from "react";
import { EyeFilledIcon, EyeSlashFilledIcon } from "../icons"; import { EyeFilledIcon, EyeSlashFilledIcon } from "../icons";
import { Button } from "@heroui/button"; import { Button } from "@heroui/button";
import Link from "next/link"; import Link from "next/link";
@ -26,6 +26,7 @@ import PasswordChecklist from "react-password-checklist";
import { Image, InputOtp } from "@heroui/react"; import { Image, InputOtp } from "@heroui/react";
export default function Login() { export default function Login() {
const accessToken = Cookies.get("access_token");
const router = useRouter(); const router = useRouter();
const [isVisible, setIsVisible] = useState(false); const [isVisible, setIsVisible] = useState(false);
const [isVisibleSetup, setIsVisibleSetup] = useState([false, false]); const [isVisibleSetup, setIsVisibleSetup] = useState([false, false]);
@ -47,6 +48,12 @@ export default function Login() {
const [checkUsernameValue, setCheckUsernameValue] = useState(""); const [checkUsernameValue, setCheckUsernameValue] = useState("");
const MySwal = withReactContent(Swal); const MySwal = withReactContent(Swal);
useEffect(() => {
if (accessToken) {
router.push("/admin/dashboard");
}
}, []);
const setValUsername = (e: any) => { const setValUsername = (e: any) => {
const uname = e.replaceAll(/[^\w.-]/g, ""); const uname = e.replaceAll(/[^\w.-]/g, "");
setUsername(uname.toLowerCase()); setUsername(uname.toLowerCase());

View File

@ -16,9 +16,11 @@ import { useEffect, useState } from "react";
import { error, success } from "@/config/swal"; import { error, success } from "@/config/swal";
import { subscription } from "@/services/subscribe"; import { subscription } from "@/services/subscribe";
import { Image } from "@heroui/react"; import { Image } from "@heroui/react";
import Cookies from "js-cookie";
export default function FooterNew(props: { margin?: boolean }) { export default function FooterNew(props: { margin?: boolean }) {
const [emailValue, setEmailValue] = useState(""); const [emailValue, setEmailValue] = useState("");
const accessToken = Cookies.get("access_token");
const doSubscribe = async () => { const doSubscribe = async () => {
const isValidEmail = (email: string): boolean => { const isValidEmail = (email: string): boolean => {
@ -197,7 +199,7 @@ export default function FooterNew(props: { margin?: boolean }) {
</a> </a>
</div> </div>
</div> </div>
<Link href={`/auth`}> <Link href={accessToken ? "/admin/dashboard" : `/auth`}>
<Button className="mt-1 bg-[#BE0106] text-white"> <Button className="mt-1 bg-[#BE0106] text-white">
<p className="text-xs">Kontributor Wilayah</p> <p className="text-xs">Kontributor Wilayah</p>
</Button> </Button>

View File

@ -560,10 +560,9 @@ export default function SuggestionsTable() {
<SelectItem key="10">10</SelectItem> <SelectItem key="10">10</SelectItem>
</Select> </Select>
</div> </div>
<Button color="primary" className="text-white" onPress={doExport}>
Export <div className="flex flex-col gap-1 w-full lg:w-[120px]">
</Button> <p className="font-semibold text-sm">Start Date</p>
<div className=" w-[220px] h-[40px] flex flex-row gap-2 justify-between items-center">
<Popover <Popover
placement="bottom" placement="bottom"
classNames={{ content: ["!bg-transparent", "p-0"] }} classNames={{ content: ["!bg-transparent", "p-0"] }}
@ -586,7 +585,10 @@ export default function SuggestionsTable() {
/> />
</PopoverContent> </PopoverContent>
</Popover> </Popover>
</div>
<div className="flex flex-col gap-1 w-full lg:w-[120px]">
<p className="font-semibold text-sm">End Date</p>
<Popover <Popover
placement="bottom" placement="bottom"
classNames={{ content: ["!bg-transparent", "p-0"] }} classNames={{ content: ["!bg-transparent", "p-0"] }}
@ -610,6 +612,13 @@ export default function SuggestionsTable() {
</PopoverContent> </PopoverContent>
</Popover> </Popover>
</div> </div>
{/* <div className=" w-[220px] h-[40px] flex flex-row gap-2 justify-between items-center">
</div> */}
<Button color="primary" className="text-white" onPress={doExport}>
Export
</Button>
</div> </div>
<Table <Table
aria-label="micro issue table" aria-label="micro issue table"