import { ArrowDownOutlined } from '@ant-design/icons'; import { Button } from '@imphnen-frontend-service/ui/atoms'; import { FC, Fragment, ReactElement, useState } from 'react'; import ModalFormForgotPassword from './_components/form/modal-form-forgot-password'; import ModalFormLogin from './_components/form/modal-form-login'; import ModalFormRegister from './_components/form/modal-form-register'; import { GachaItem } from './_components/item/gacha-item'; import { useModalLogin } from '@imphnen-frontend-service/utils'; import { useGachaItemList, useUserCredits, useExecuteGachaRoll } from '@imphnen-frontend-service/service'; import { toast } from 'sonner'; import type { TGachaRollItemDto } from '@imphnen-frontend-service/service'; export const Components: FC = (): ReactElement => { const { showModalLogin, setShowModalLogin } = useModalLogin(); const [showModalForgotPassword, setShowModalForgotPassword] = useState(false); const [showModalRegister, setShowModalRegister] = useState(false); const [spinResult, setSpinResult] = useState(null); const { data: creditsData } = useUserCredits(); const { data: itemsData } = useGachaItemList({ per_page: 10 }); const executeRoll = useExecuteGachaRoll(); const gachaItems = itemsData?.data ?? []; const availableRolls = creditsData?.available_rolls ?? 0; const scrollToRoulette = () => { const rouletteSection = document.getElementById('roulette'); if (rouletteSection) { rouletteSection.scrollIntoView({ behavior: 'smooth' }); } }; const handleForgotPasswordClick = () => { setShowModalLogin(false); setShowModalForgotPassword(true); }; const handleSpin = async () => { if (availableRolls <= 0) { toast.error('Kamu tidak punya gacha roll. Beli dulu ya!'); return; } try { const result = await executeRoll.mutateAsync(); setSpinResult(result); const wonItem = gachaItems.find((item) => item.id === result.item_id); toast.success(`Selamat! Kamu mendapatkan: ${wonItem?.name ?? 'item'}`); } catch { toast.error('Gagal spin gacha. Coba lagi ya!'); } }; return (
IMPHNEN Logo

New Merchandise

Coming UP

Periode Gacha: 1 - 31 Maret 2025

Let's Go Checkout Our Merch &

Gacha Your Prize Here

{creditsData && (
Roll tersisa: {availableRolls}
)}
Merch 1
Official Merch IMPHNEN
~ 175k ~
Merch 2 Merch 3 Merch 1
IMPHNEN Mini Merch
~ 90k ~

Gacha Roulette

How to participate

Kamu harus melakukan pembelian merch batch 2 di shopee IMPHNEN

How to gacha

  1. First, press the "Spin Now" button
  2. If the merch does not match you can reroll by paying IDR5,000
  3. If it is appropriate you can submit
  4. Then fill in the data for your merch delivery process
{spinResult ? `Hadiahmu: ${gachaItems.find((i) => i.id === spinResult.item_id)?.name ?? 'Item'}` : 'Here Take Your Prize'}
{gachaItems.length > 0 ? ( gachaItems.map((item) => ( )) ) : ( <> )}
setShowModalLogin(false)} onForgotPassword={handleForgotPasswordClick} setIsOpenRegisterModal={setShowModalRegister} key="login" /> { setShowModalRegister(false); }} key="register" /> { setShowModalForgotPassword(false); setShowModalLogin(true); }} key="forgot-password" />
); }; export default Components;