Undangan · Buat password

The invite link: set your own password (or the link has expired). No shell.

$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/screen-undangan.json
Buka layar penuh

When to use

  • The page an invite link opens (/undangan/<token>): the person sets their own password and is signed in. HR never sees a password.
  • The invite goes by email, or by WhatsApp to the phone number when the person has no email.
  • UndanganKedaluwarsa: the same link after 7 days or after it was used once.

When not to use

  • Signing in with an existing password → Login.
  • Changing a password while signed in → the account menu ("Ubah password").

Built from

Usage

The screen is the page content only. Put it inside AppShell (once, in your layout) and pass your data.

page.tsx
import { Undangan, UndanganKedaluwarsa } from "@/components/screens/undangan/undangan"import Link from "next/link"export default async function Page({ params }: { params: { token: string } }) {  const invite = await getInvite(params.token) // null when expired or used  if (!invite) return <UndanganKedaluwarsa loginHref="/login" loginRender={<Link href="/login" />} />  return (    <InviteForm      person={invite.person} // { firstName, channel: "whatsapp" | "email", identifier }      company={invite.company}      role={invite.role} // "employee" | "admin": picks the subtitle      expiresOn={invite.expiresOn} // ISO; ends at the end of that day (WIB)      today={today()}      // client: status, error, attempt, onSubmit → POST /api/invite/<token>/password,      // then go to the home of the role and toast "Password sudah disimpan. Selamat datang di MaHR."    />  )}

Installation

Adds the screen, its parts and its types. The components it uses come with it (registry dependencies).

terminal
bunx --bun shadcn@latest add https://mahrdesign.faizintifada.com/r/screen-undangan.json

API

Undangan

import { Undangan } from "@/components/screens/undangan/undangan"
PropTypeDefaultDescription
person{ firstName; channel: "whatsapp" | "email"; identifier }–The read-only sign-in field: "Nomor HP" + smartphone icon, or "Email" + mail icon, with its helper line.
company · rolestring · "employee" | "admin""employee"The subtitle: employee "… untuk melihat slip gaji dan mengajukan cuti."; admin "… untuk mengelola karyawan, cuti, dan gaji."
expiresOn · todayISO date · ISO date–"Link ini berlaku sampai Kamis, 24 Des 2026." · "… sampai hari ini." on the last day.
status · error · attempt"idle" | "submitting" · { kind: "network" | "server" } | null · number–"Menyimpan…"; a failed save shows "Gagal menyimpan password. Coba lagi." above the primary.
onSubmit({ password }) => void–Only when 8+ characters and both fields are the same; else field errors, shake, focus, red rules.
autoFocus · minHeight · logoboolean · number | string · ReactNode–As Login.

UndanganKedaluwarsa

import { UndanganKedaluwarsa } from "@/components/screens/undangan/undangan"
PropTypeDefaultDescription
loginHref · loginRenderstring · ReactElement–"Sudah punya password? Masuk": one secondary pill that is a real link (docs/buttons.md, dead-end page).