diff --git a/resources/js/Components/NavIcon.tsx b/resources/js/Components/NavIcon.tsx index 4f6944a..1a8f372 100644 --- a/resources/js/Components/NavIcon.tsx +++ b/resources/js/Components/NavIcon.tsx @@ -9,24 +9,40 @@ interface NavIconProps { active: boolean; icon: IconProp; notif?: number; + className?: string; } -export default function NavIcon({ path, active, icon, notif }: NavIconProps) { +export default function NavIcon({ + path, + active, + icon, + notif, + className, +}: NavIconProps) { useEffect(() => {}, [active]); return ( - {active ? ( -
+
+ {active ? ( +
+ + + +
+ ) : ( - + -
- ) : ( - - - - )} + )} +
); } diff --git a/resources/js/Layouts/AuthenticatedLayout.tsx b/resources/js/Layouts/AuthenticatedLayout.tsx index 4ad68da..a476bb6 100644 --- a/resources/js/Layouts/AuthenticatedLayout.tsx +++ b/resources/js/Layouts/AuthenticatedLayout.tsx @@ -14,6 +14,13 @@ import NavIcon from "@/Components/NavIcon"; import CoinIcon from "@/Components/CoinIcon"; import { useApi } from "@/utils/useApi"; import { formatedBalance } from "@/utils/manipulation"; +import Joyride, { CallBackProps, STATUS, Step } from "react-joyride"; +import useLocalStorageState from "use-local-storage-state"; + +interface State { + run: boolean; + steps: Step[]; +} export default function Authenticated({ user, @@ -36,8 +43,169 @@ export default function Authenticated({ const notificationsGet: Notification[] = notifData ?? []; const unReadNotif = notificationsGet.length; + // START ONBOARD + //const [onBoard, setOnBoard] = useState(true); + const [onBoard, setOnBoard] = useLocalStorageState("onBoard", { + defaultValue: true, + }); + const [{ steps: stepsOnBoard }] = useState({ + run: true, + steps: [ + { + content: Selamat Datang di StepCash!, + placement: "center", + target: "body", + styles: { + options: { + width: 200, + }, + }, + }, + { + title: Progress Harian, + content: "Progress pencapaian target langkah harian", + placement: "top", + styles: { + options: { + width: 300, + }, + }, + target: ".progress span", + }, + { + title: Total Koin, + content: + "Jumlah langkah harianmu akan dikonversikan ke koin dan ditampilkan disini", + placement: "top", + styles: { + options: { + width: 300, + }, + }, + target: ".totalCoin button", + }, + { + title: ( + Sinkrinisasi Manual + ), + content: "Klik ini untuk sinkronisasi manual data langkah", + placement: "top", + styles: { + options: { + width: 300, + }, + }, + target: ".progress div", + }, + { + title: Total Langkah, + content: "Jumlah langkah yang kamu lakukan hari ini", + placement: "top", + styles: { + options: { + width: 300, + }, + }, + target: ".totalStep", + }, + { + title: Waktu, + content: "Waktu yang dihabiskan berjalan kaki hari ini", + placement: "right", + styles: { + options: { + width: 300, + }, + }, + target: ".timeSpent", + }, + { + title: Jarak Tempuh, + content: "Jumlah jarak tempuh selama berjalan kaki hari ini", + placement: "top", + styles: { + options: { + width: 300, + }, + }, + target: ".totalDistance", + }, + { + title: Jumlah Kalori, + content: "Jumlah kalori yang dibakar selama aktivitas hari ini", + placement: "top", + styles: { + options: { + width: 300, + }, + }, + target: ".totalCalory", + }, + { + title: Halaman Hadiah, + content: + "Tukarkan koin yang kamu dapatkan dengan produk pada halaman ini", + placement: "top", + styles: { + options: { + width: 300, + }, + }, + target: ".rewards", + }, + { + title: ( + Halaman Notifikasi + ), + content: + "Perkembangan terkait penukaran hadiah kamu akan diinformasikan disini", + placement: "top", + styles: { + options: { + width: 300, + }, + }, + target: ".notifications", + }, + { + title: Halaman Profil, + content: "Kamu juga bisa mengubah profil kamu pada halaman ini", + placement: "top", + styles: { + options: { + width: 300, + }, + }, + target: ".profile", + }, + ], + }); + + const handleJoyrideCallback = (data: CallBackProps) => { + const { status, type } = data; + const finishedStatuses: string[] = [STATUS.FINISHED, STATUS.SKIPPED]; + + if (finishedStatuses.includes(status)) { + setOnBoard(false); + } + }; + // END ONBOARD return (
+