Page templates
Ready, working Next.js (App Router) pages. When writing a new page, copy the closest template first and adapt it; they show the right way to use the library (server/client split, Form + server action, *Field, skeleton loading, mobile layout). npx @yasinsensoy/web template <name> copies the files into place in the project (into src/app when it exists). Register the icon names used in the templates with UIProvider icons or replace them with your own; adjust the paths (/panel, /giris) to your project.
app-shell
App skeleton: the Sidebar main menu on the left, page content next to it. On desktop it collapses into an icon rail (⌘B / Ctrl+B) and remembers its state; on phones it becomes a bottom navigation bar. The user menu is at the bottom of the sidebar.
- It is a server component: menu items are written on the server and icons are given by name. The active page is marked automatically from the URL (the
@yasinsensoy/web/nextprovider wiresusePathname). - The
dashboardandsettingstemplates are written to sit inside this skeleton (/panel,/panel/settings). - Icon names used:
ev,grafik,sepet,kullanici,klasor,ayarlar,cikis,diger. Register them withUIProvider iconsor replace them with your own names.
Files
app/panel/layout.tsx
dashboard
Dashboard: summary cards (KPI) with small trend lines, a monthly income/expense chart, a traffic channels donut chart, a recent orders table and an activity feed.
- It is a server component: data is read on the server from the functions in
data.ts; only the interactive parts (chart, menu) go to the browser. - While loading,
loading.tsxshows a skeleton in the same layout; the page does not shift. - On phones the cards stack and table rows turn into cards.
- Runs at
/panelinside theapp-shelltemplate; can also be used on its own. - Icon names used:
indir,ekle,diger.
Files
app/panel/page.tsxapp/panel/data.tsapp/panel/loading.tsx
login
Sign-in page: a centered card, email + password, "Forgot password", social sign-in buttons and a two-step verification code (OTP).
- Works with a single server action (
actions.ts); the two steps change in the same card, the page does not reload. - Correct
autoCompletevalues are set for the browser's password manager and one-tap code filling; on Android the SMS code fills automatically via WebOTP, and the form submits itself when the code is complete. - Pressing and holding the eye at the end of the password field shows the password.
- Errors appear below the field and the first invalid field is focused.
- On phones the card is full width, and when the keyboard opens the field does not stay under it.
- Runs outside the panel layout, with its own layout (
app/login).
Files
app/login/page.tsxapp/login/actions.tsapp/login/login-form.tsx
settings
Settings page: Profile, Account, Notifications and Appearance tabs and a "Delete account" section.
- Each tab is a separate
Formand server action (actions.ts): validation happens in the browser (required,type,mask) and on the server, server errors are spread below the fields viaForm state, and success is announced withtoast. - The profile photo is picked with
FileFieldand cropped round withedit(MediaEditor). - Phone uses
mask="phone"; password fields reveal on press and hold. - The theme is changed with
useTheme+ThemeView; no flicker on first paint. - Deletion is confirmed with
await confirm(...); while deleting, the dialog's confirm button shows loading. - A tab can be linked to:
/panel/settings?tab=account. - Icon names used:
kullanici,kilit,zil,ayarlar.
Files
app/panel/settings/page.tsxapp/panel/settings/actions.tsapp/panel/settings/forms.tsx