From ae17e2d0ba461cd6bdbca99e981c42e7f29c6450 Mon Sep 17 00:00:00 2001 From: mphstar Date: Wed, 26 Feb 2025 12:11:20 +0700 Subject: [PATCH] feat: slicing page ranking --- package-lock.json | 39 +++- package.json | 1 + .../{Carousel.tsx => CarouselSusunHuruf.tsx} | 0 .../organisms/CarouselTebakHuruf.tsx | 126 +++++++++++++ src/components/organisms/FooterPage.tsx | 6 +- src/components/organisms/HeaderPage.tsx | 2 +- src/pages/Kamus.tsx | 30 ++- src/pages/Kuis.tsx | 35 +++- .../Kuis/MenyusunHuruf/MenyusunHuruf.tsx | 56 +++++- src/pages/Kuis/TebakHuruf/TebakHuruf.tsx | 98 +++++++++- src/pages/Ranking/Ranking.tsx | 174 ++++++++++++++++++ src/routes/routes.ts | 5 + 12 files changed, 540 insertions(+), 32 deletions(-) rename src/components/organisms/{Carousel.tsx => CarouselSusunHuruf.tsx} (100%) create mode 100644 src/components/organisms/CarouselTebakHuruf.tsx create mode 100644 src/pages/Ranking/Ranking.tsx diff --git a/package-lock.json b/package-lock.json index 1e25f80..194c864 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-icons": "^5.3.0", + "react-nice-avatar": "^1.5.0", "react-router-dom": "^6.26.1", "react-virtualized-auto-sizer": "^1.0.24", "react-window": "^1.8.10", @@ -2069,6 +2070,12 @@ "node": ">= 6" } }, + "node_modules/chroma-js": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.6.0.tgz", + "integrity": "sha512-BLHvCB9s8Z1EV4ethr6xnkl/P2YRFOGqfgvuMG/MyCbZPrTA+NeiByY6XvgF0zP4/2deU2CXnWyMa3zu1LqQ3A==", + "license": "(BSD-3-Clause AND Apache-2.0)" + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -3475,7 +3482,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -3809,6 +3815,17 @@ "node": ">= 0.8.0" } }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -3869,6 +3886,26 @@ "react": "*" } }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "license": "MIT" + }, + "node_modules/react-nice-avatar": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/react-nice-avatar/-/react-nice-avatar-1.5.0.tgz", + "integrity": "sha512-sGusqbgWIA4Il6Y0zHEfs4XF+a06etNljhwFYiHIGATDmVVf53Nez7U7GY5EwEz5/xGuUhs6uel5AC5NN/2UPg==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.14.3", + "chroma-js": "^2.1.2", + "prop-types": "^15.7.2" + }, + "peerDependencies": { + "react": ">=16.0.0" + } + }, "node_modules/react-refresh": { "version": "0.14.2", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz", diff --git a/package.json b/package.json index 24dd0b7..5769e77 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-icons": "^5.3.0", + "react-nice-avatar": "^1.5.0", "react-router-dom": "^6.26.1", "react-virtualized-auto-sizer": "^1.0.24", "react-window": "^1.8.10", diff --git a/src/components/organisms/Carousel.tsx b/src/components/organisms/CarouselSusunHuruf.tsx similarity index 100% rename from src/components/organisms/Carousel.tsx rename to src/components/organisms/CarouselSusunHuruf.tsx diff --git a/src/components/organisms/CarouselTebakHuruf.tsx b/src/components/organisms/CarouselTebakHuruf.tsx new file mode 100644 index 0000000..92b58e9 --- /dev/null +++ b/src/components/organisms/CarouselTebakHuruf.tsx @@ -0,0 +1,126 @@ +import { useState } from "react"; +import { motion, AnimatePresence } from "framer-motion"; + +const slides = [ + { + title: "Nama", + description: + "Masukkan nama Anda untuk memulai. Nama Anda akan digunakan untuk personalisasi pengalaman Anda selama menggunakan aplikasi ini.", + image: "/assets/images/susun_1.svg", + button: "Next", + }, + { + title: "Tebak Huruf", + description: + "Tebak huruf sesuai soal yang ditampilkan. Ini adalah latihan untuk meningkatkan keterampilan kognitif dan kecepatan berpikir Anda.", + image: "/assets/images/susun_2.svg", + button: "Next", + }, + { + title: "Proses Jawaban", + description: + "Tahan tangan Anda di depan kamera sampai proses selesai dan tampil dialog benar atau tidaknya jawaban.", + image: "/assets/images/susun_3.svg", + button: "Next", + }, + { + title: "Score", + description: + "Raih skor tertinggimu dengan menyelesaikan tugas dengan cepat dan tepat. Skor Anda akan dibandingkan dengan pengguna lain di papan peringkat.", + image: "/assets/images/susun_4.svg", + button: "Get Started", + }, +]; + +export default function Carousel() { + const [current, setCurrent] = useState(0); + + const nextSlide = () => { + setCurrent((prev) => (prev === slides.length - 1 ? 0 : prev + 1)); + }; + + const prevSlide = () => { + setCurrent((prev) => (prev === 0 ? slides.length - 1 : prev - 1)); + }; + + return ( +
+ + {slides.map( + (slide, index) => + index === current && ( + + {slide.title} + {/*

{slide.title}

*/} +

+ {slide.description} +

+ {/* */} +
+ ) + )} +
+
+ {slides.map((_, index) => ( +
+ + +
+ ); +} diff --git a/src/components/organisms/FooterPage.tsx b/src/components/organisms/FooterPage.tsx index 6668e8f..8b90f73 100644 --- a/src/components/organisms/FooterPage.tsx +++ b/src/components/organisms/FooterPage.tsx @@ -4,7 +4,11 @@ const FooterPage = () => {

© 2024 Kedai Susu Tuli & - Developed by Mphstar ❤️ + Developed by{" "} + + Mphstar + {" "} + ❤️

diff --git a/src/components/organisms/HeaderPage.tsx b/src/components/organisms/HeaderPage.tsx index 954d641..3d4ef1f 100644 --- a/src/components/organisms/HeaderPage.tsx +++ b/src/components/organisms/HeaderPage.tsx @@ -22,7 +22,7 @@ const HeaderPage = () => {