25 Commits

Author SHA1 Message Date
b75a51727b chore: bump version to 0.1.8 2026-05-12 15:00:59 +08:00
6fdcc7f6ec fix: import logo as asset instead of hardcoded /src path 2026-05-12 15:00:44 +08:00
48118cad40 chore: bump version to 0.1.7 2026-05-12 14:27:39 +08:00
3cf656951d Merge remote-tracking branch 'origin/build/stg' into amalia/12-mei-26 2026-05-12 14:27:33 +08:00
7ca78ad39d chore: bump version to 0.1.6 2026-05-12 14:27:12 +08:00
18f719f551 Merge remote-tracking branch 'build/stg' into amalia/12-mei-26 2026-05-12 14:26:49 +08:00
fced7d4c1c feat: show isDummy flag on village detail and list pages 2026-05-12 14:10:29 +08:00
b39d1d5099 fix: update reset filters button style and remove filter icon 2026-05-12 11:47:48 +08:00
1831e757cd Merge pull request 'amalia/07-mei-26' (#19) from amalia/07-mei-26 into main
Reviewed-on: #19
2026-05-07 17:36:54 +08:00
f926ab2701 feat: add colored top border to stats cards 2026-05-07 12:21:08 +08:00
032386a549 feat: redesign login and splash screen with playful visual lift 2026-05-07 12:08:34 +08:00
5e44aa9021 chore: bump version to 0.1.6 2026-05-07 11:14:03 +08:00
273e4041e8 Merge branch 'amalia/05-mei-26' into stg 2026-05-07 11:13:13 +08:00
f469faf740 fix: add Secure flag to session cookies in production 2026-05-07 11:12:30 +08:00
f3c90ba290 chore: bump version to 0.1.4 2026-05-07 11:11:25 +08:00
d898671be9 Merge pull request 'amalia/05-mei-26' (#18) from amalia/05-mei-26 into main
Reviewed-on: #18
2026-05-05 17:28:45 +08:00
aea1cc1be2 chore: bump version to 0.1.5 2026-05-05 14:21:05 +08:00
77ccf4cf33 Merge remote-tracking branch 'build/stg' into stg 2026-05-05 14:19:46 +08:00
a50a9d6456 chore: bump version to 0.1.4 2026-05-05 13:56:39 +08:00
6cc86dafd8 Merge branch 'amalia/30-apr-26' into stg 2026-04-30 16:01:06 +08:00
73849304ae Merge branch 'stg' of https://github.com/bipprojectbali/monitoring-app into stg 2026-04-29 17:26:48 +08:00
6258c580a8 Merge branch 'amalia/29-apr-26' into stg 2026-04-29 17:24:52 +08:00
292e338a39 chore: bump version to 0.1.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 17:12:18 +08:00
90280fcac7 chore: bump version to 0.1.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 16:51:05 +08:00
Amalia
21e2923c02 Merge pull request #1 from bipprojectbali/amalia/29-apr-26
Amalia/29 apr 26
2026-04-29 14:00:13 +08:00
8 changed files with 238 additions and 100 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "bun-react-template",
"version": "0.1.3",
"version": "0.1.8",
"private": true,
"type": "module",
"scripts": {

View File

@@ -11,6 +11,9 @@ import { getMinioDownloadUrl, uploadBugImage } from './lib/minio'
import { addConnection, broadcastToAdmins, getOnlineUserIds, removeConnection } from './lib/presence'
import { parseSchema } from './lib/schema-parser'
const isProduction = process.env.NODE_ENV === 'production'
const cookieFlags = isProduction ? '; Secure' : ''
function getPublicOrigin(request: Request): string {
if (process.env.BUN_PUBLIC_BASE_URL) return process.env.BUN_PUBLIC_BASE_URL.replace(/\/$/, '')
const url = new URL(request.url)
@@ -127,7 +130,7 @@ export function createApp() {
})
const headers = new Headers()
headers.set('Location', `https://accounts.google.com/o/oauth2/v2/auth?${params}`)
headers.set('Set-Cookie', `oauth_state=${state}; Path=/; HttpOnly; SameSite=Lax; Max-Age=600`)
headers.set('Set-Cookie', `oauth_state=${state}; Path=/; HttpOnly; SameSite=Lax; Max-Age=600${cookieFlags}`)
return new Response(null, { status: 302, headers })
}, {
detail: {
@@ -212,8 +215,8 @@ export function createApp() {
const redirectPath = user.role === 'DEVELOPER' ? '/dev' : user.role === 'USER' ? '/profile' : '/dashboard'
const headers = new Headers()
headers.append('Location', redirectPath)
headers.append('Set-Cookie', `session=${token}; Path=/; HttpOnly; SameSite=Lax; Max-Age=86400`)
headers.append('Set-Cookie', 'oauth_state=; Path=/; HttpOnly; Max-Age=0')
headers.append('Set-Cookie', `session=${token}; Path=/; HttpOnly; SameSite=Lax; Max-Age=86400${cookieFlags}`)
headers.append('Set-Cookie', `oauth_state=; Path=/; HttpOnly; Max-Age=0${cookieFlags}`)
return new Response(null, { status: 302, headers })
}, {
detail: {
@@ -241,7 +244,7 @@ export function createApp() {
const token = crypto.randomUUID()
const expiresAt = new Date(Date.now() + 24 * 60 * 60 * 1000) // 24 hours
await prisma.session.create({ data: { token, userId: user.id, expiresAt } })
set.headers['set-cookie'] = `session=${token}; Path=/; HttpOnly; SameSite=Lax; Max-Age=86400`
set.headers['set-cookie'] = `session=${token}; Path=/; HttpOnly; SameSite=Lax; Max-Age=86400${cookieFlags}`
await createSystemLog(user.id, 'LOGIN', 'Logged in successfully')
return { user: { id: user.id, name: user.name, email: user.email, role: user.role, image: user.image } }
}, {
@@ -266,7 +269,7 @@ export function createApp() {
await prisma.session.deleteMany({ where: { token } })
}
}
set.headers['set-cookie'] = 'session=; Path=/; HttpOnly; Max-Age=0'
set.headers['set-cookie'] = `session=; Path=/; HttpOnly; Max-Age=0${cookieFlags}`
return { ok: true }
}, {
detail: {

View File

@@ -14,18 +14,21 @@ interface StatsCardProps {
}
export function StatsCard({ title, value, description, icon: Icon, color, trend }: StatsCardProps) {
const accentColor = `var(--mantine-color-${color ?? 'brand-blue'}-5)`
return (
<Card
withBorder
padding="lg"
radius="xl"
className="premium-card"
styles={(theme) => ({
styles={{
root: {
backgroundColor: 'var(--mantine-color-body)',
borderColor: 'rgba(128,128,128,0.1)',
borderTop: `3px solid ${accentColor}`,
},
})}
}}
>
<Group justify="space-between" mb="xs">
<ThemeIcon

View File

@@ -37,11 +37,10 @@ import {
TbCircleX,
TbDeviceDesktop,
TbDeviceMobile,
TbFilter,
TbHistory,
TbPhoto,
TbPlus,
TbSearch,
TbSearch
} from 'react-icons/tb'
import { API_URLS } from '../config/api'
@@ -431,10 +430,9 @@ function AppErrorsPage() {
/>
<Stack justify="flex-end">
<Button
variant="subtle"
color="gray"
variant="filled"
color="violet"
size="sm"
leftSection={<TbFilter size={16} />}
onClick={() => { setSearch(''); setStatus('all') }}
>
Reset Filters

View File

@@ -1,5 +1,6 @@
import { AreaChart } from '@mantine/charts'
import {
Badge,
Box,
Button,
Card,
@@ -10,6 +11,7 @@ import {
SegmentedControl,
SimpleGrid,
Stack,
Switch,
Text,
Textarea,
TextInput,
@@ -31,6 +33,7 @@ import {
TbLayoutKanban,
TbMapPin,
TbPower,
TbTestPipe,
TbUser,
TbUsers,
TbUsersGroup,
@@ -153,7 +156,7 @@ function VillageDetailPage() {
const [editModalOpened, { open: openEditModal, close: closeEditModal }] = useDisclosure(false)
const [isUpdating, setIsUpdating] = useState(false)
const [isEditing, setIsEditing] = useState(false)
const [editForm, setEditForm] = useState({ name: '', desc: '' })
const [editForm, setEditForm] = useState({ name: '', desc: '', isDummy: false })
const village = infoRes?.data
const stats = gridRes?.data
@@ -161,7 +164,8 @@ function VillageDetailPage() {
const openEdit = () => {
setEditForm({
name: village?.name || '',
desc: village?.desc || ''
desc: village?.desc || '',
isDummy: village?.isDummy ?? false,
})
openEditModal()
}
@@ -188,7 +192,8 @@ function VillageDetailPage() {
body: JSON.stringify({
id: village.id,
name: editForm.name,
desc: editForm.desc
desc: editForm.desc,
isDummy: editForm.isDummy,
})
})
@@ -361,7 +366,20 @@ function VillageDetailPage() {
</ThemeIcon>
<Stack gap={6}>
<Title order={2} style={{ color: 'white', lineHeight: 1.1 }}>{village.name}</Title>
<Group gap="xs" align="center">
<Title order={2} style={{ color: 'white', lineHeight: 1.1 }}>{village.name}</Title>
{village.isDummy && (
<Badge
size="sm"
variant="light"
color="yellow"
leftSection={<TbTestPipe size={11} />}
style={{ textTransform: 'none' }}
>
Dummy
</Badge>
)}
</Group>
<Group gap={6}>
<TbMapPin size={14} color="rgba(255,255,255,0.8)" />
@@ -526,6 +544,12 @@ function VillageDetailPage() {
value={editForm.desc}
onChange={(e) => setEditForm(prev => ({ ...prev, desc: e.currentTarget.value }))}
/>
<Switch
label="Dummy Village"
description="Tandai desa ini sebagai data dummy"
checked={editForm.isDummy}
onChange={(e) => setEditForm(prev => ({ ...prev, isDummy: e.currentTarget.checked }))}
/>
<Group justify="flex-end" gap="sm" mt="md">
<Button variant="light" color="gray" onClick={closeEditModal} radius="md">
Cancel

View File

@@ -36,6 +36,7 @@ import {
TbMapPin,
TbPlus,
TbSearch,
TbTestPipe,
TbUser,
TbX,
} from 'react-icons/tb'
@@ -50,6 +51,7 @@ interface APIVillage {
id: string
name: string
isActive: boolean
isDummy: boolean
createdAt: string
perbekel: string | null
}
@@ -95,9 +97,16 @@ function VillageGridCard({ village, onClick }: { village: APIVillage; onClick: (
>
<TbHome2 size={22} />
</ThemeIcon>
<Badge color={cfg.color} variant="light" radius="sm" size="sm">
{cfg.label}
</Badge>
<Group gap={6}>
{village.isDummy && (
<Badge color="yellow" variant="light" radius="sm" size="sm" leftSection={<TbTestPipe size={11} />}>
Dummy
</Badge>
)}
<Badge color={cfg.color} variant="light" radius="sm" size="sm">
{cfg.label}
</Badge>
</Group>
</Group>
<Text fw={800} size="lg" mb={2}>
@@ -175,6 +184,11 @@ function VillageListRow({ village, onClick }: { village: APIVillage; onClick: ()
<Stack gap={2}>
<Group gap="sm">
<Text fw={700} size="sm">{village.name}</Text>
{village.isDummy && (
<Badge color="yellow" variant="light" radius="sm" size="xs" leftSection={<TbTestPipe size={10} />}>
Dummy
</Badge>
)}
<Badge color={cfg.color} variant="light" radius="sm" size="xs">
{cfg.label}
</Badge>

View File

@@ -1,7 +1,7 @@
import { Button, Container, Group, Stack, Text, Title } from '@mantine/core'
import { Button, Box, Center, Stack, Text, Title } from '@mantine/core'
import { Link, createFileRoute } from '@tanstack/react-router'
import { SiBun } from 'react-icons/si'
import { TbBrandReact, TbLogin, TbRocket } from 'react-icons/tb'
import { TbLogin } from 'react-icons/tb'
import logoUrl from '../../logo.svg'
export const Route = createFileRoute('/')({
component: HomePage,
@@ -9,28 +9,67 @@ export const Route = createFileRoute('/')({
function HomePage() {
return (
<Container size="sm" py="xl">
<Stack align="center" gap="lg">
<Group gap="lg">
<SiBun size={64} color="#fbf0df" />
<TbBrandReact size={64} color="#61dafb" />
</Group>
<Box style={{ minHeight: '100vh', background: '#1a1a2e', position: 'relative', overflow: 'hidden' }}>
{/* background blobs */}
<Box style={{
position: 'absolute', top: '-15%', left: '-10%',
width: 500, height: 500, borderRadius: '50%',
background: 'radial-gradient(circle, rgba(124,58,237,0.25) 0%, transparent 70%)',
pointerEvents: 'none',
}} />
<Box style={{
position: 'absolute', bottom: '-20%', right: '-10%',
width: 600, height: 600, borderRadius: '50%',
background: 'radial-gradient(circle, rgba(79,70,229,0.2) 0%, transparent 70%)',
pointerEvents: 'none',
}} />
<Box style={{
position: 'absolute', top: '50%', left: '60%',
width: 300, height: 300, borderRadius: '50%',
background: 'radial-gradient(circle, rgba(168,85,247,0.1) 0%, transparent 70%)',
pointerEvents: 'none',
}} />
<Title order={1}>Bun + Elysia + Vite + React</Title>
<Center mih="100vh" style={{ position: 'relative', zIndex: 1 }}>
<Stack align="center" gap="xl">
<img
src={logoUrl}
width={72}
height={72}
alt="logo"
style={{ borderRadius: 20, boxShadow: '0 4px 32px rgba(124,58,237,0.5)', display: 'block' }}
/>
<Text c="dimmed" ta="center" maw={480}>
Full-stack starter template with Mantine UI, TanStack Router, and session-based auth.
</Text>
<Stack align="center" gap={8}>
<Title
order={1}
c="white"
fw={800}
ta="center"
style={{ fontSize: '2.6rem', letterSpacing: '-0.5px', lineHeight: 1.15 }}
>
Monitoring System
</Title>
<Text c="dimmed" ta="center" size="md" maw={320} lh={1.6}>
Pantau semua aplikasi dalam satu tempat, real-time.
</Text>
</Stack>
<Group>
<Button component={Link} to="/login" leftSection={<TbLogin size={18} />} variant="filled">
Login
<Button
component={Link}
to="/login"
leftSection={<TbLogin size={18} />}
size="md"
style={{
background: 'linear-gradient(135deg, #4f46e5, #7c3aed)',
border: 'none',
paddingInline: 32,
}}
>
Masuk
</Button>
<Button component={Link} to="/dashboard" leftSection={<TbRocket size={18} />} variant="light">
Dashboard
</Button>
</Group>
</Stack>
</Container>
</Stack>
</Center>
</Box>
)
}

View File

@@ -1,10 +1,11 @@
import { useLogin } from '@/frontend/hooks/useAuth'
import logoUrl from '../../logo.svg'
import {
Alert,
Box,
Button,
Center,
Divider,
Paper,
PasswordInput,
Stack,
Text,
@@ -38,6 +39,14 @@ export const Route = createFileRoute('/login')({
component: LoginPage,
})
const OAUTH_ERRORS: Record<string, string> = {
google_denied: 'Login dengan Google dibatalkan.',
invalid_state: 'Sesi OAuth tidak valid, silakan coba lagi.',
token_failed: 'Gagal menukar token Google, silakan coba lagi.',
userinfo_failed: 'Gagal mengambil info akun Google, silakan coba lagi.',
account_disabled: 'Akun Anda telah dinonaktifkan. Hubungi admin untuk informasi lebih lanjut.',
}
function LoginPage() {
const login = useLogin()
const { error: searchError } = Route.useSearch()
@@ -49,69 +58,117 @@ function LoginPage() {
login.mutate({ email, password })
}
const errorMessage = login.isError
? login.error.message
: searchError
? (OAUTH_ERRORS[searchError] ?? 'Login dengan Google gagal, silakan coba lagi.')
: null
return (
<Center mih="100vh">
<Paper shadow="md" p="xl" radius="md" w={400} withBorder>
<form onSubmit={handleSubmit}>
<Stack gap="md">
<Title order={2} ta="center">
Login
</Title>
<Box style={{ minHeight: '100vh', background: '#1a1a2e', position: 'relative', overflow: 'hidden' }}>
{/* background blobs */}
<Box style={{
position: 'absolute', top: '-15%', left: '-10%',
width: 500, height: 500, borderRadius: '50%',
background: 'radial-gradient(circle, rgba(124,58,237,0.25) 0%, transparent 70%)',
pointerEvents: 'none',
}} />
<Box style={{
position: 'absolute', bottom: '-20%', right: '-10%',
width: 600, height: 600, borderRadius: '50%',
background: 'radial-gradient(circle, rgba(79,70,229,0.2) 0%, transparent 70%)',
pointerEvents: 'none',
}} />
<Box style={{
position: 'absolute', top: '50%', left: '60%',
width: 300, height: 300, borderRadius: '50%',
background: 'radial-gradient(circle, rgba(168,85,247,0.1) 0%, transparent 70%)',
pointerEvents: 'none',
}} />
{(login.isError || searchError) && (
<Alert icon={<TbAlertCircle size={16} />} color="red" variant="light">
{login.isError ? login.error.message : (
{
google_denied: 'Login dengan Google dibatalkan.',
invalid_state: 'Sesi OAuth tidak valid, silakan coba lagi.',
token_failed: 'Gagal menukar token Google, silakan coba lagi.',
userinfo_failed: 'Gagal mengambil info akun Google, silakan coba lagi.',
account_disabled: 'Akun Anda telah dinonaktifkan. Hubungi admin untuk informasi lebih lanjut.',
}[searchError ?? ''] ?? 'Login dengan Google gagal, silakan coba lagi.'
)}
</Alert>
)}
<Center mih="100vh" style={{ position: 'relative', zIndex: 1 }}>
<Box
p="xl"
w={400}
style={{
background: 'rgba(36,36,36,0.75)',
backdropFilter: 'blur(20px)',
borderRadius: 20,
border: '1px solid rgba(124,58,237,0.35)',
boxShadow: '0 0 0 1px rgba(124,58,237,0.1), 0 8px 32px rgba(0,0,0,0.4), 0 0 60px rgba(124,58,237,0.12)',
}}
>
<form onSubmit={handleSubmit}>
<Stack gap="md">
{/* header */}
<Stack gap={8} align="center" mb={4}>
<img
src={logoUrl}
width={56}
height={56}
alt="logo"
style={{ borderRadius: 14, boxShadow: '0 4px 20px rgba(124,58,237,0.45)', display: 'block' }}
/>
<Title order={2} fw={700} ta="center" c="white">
Monitoring System
</Title>
<Text c="dimmed" size="sm" ta="center">
Masuk untuk melanjutkan
</Text>
</Stack>
<TextInput
label="Email"
placeholder="email@example.com"
leftSection={<TbMail size={16} />}
value={email}
onChange={(e) => setEmail(e.currentTarget.value)}
required
/>
{errorMessage && (
<Alert icon={<TbAlertCircle size={16} />} color="red" variant="light">
{errorMessage}
</Alert>
)}
<PasswordInput
label="Password"
placeholder="Password"
leftSection={<TbLock size={16} />}
value={password}
onChange={(e) => setPassword(e.currentTarget.value)}
required
/>
<TextInput
label="Email"
placeholder="email@example.com"
leftSection={<TbMail size={16} />}
value={email}
onChange={(e) => setEmail(e.currentTarget.value)}
required
/>
<Button
type="submit"
fullWidth
leftSection={<TbLogin size={18} />}
loading={login.isPending}
>
Sign in
</Button>
<PasswordInput
label="Password"
placeholder="Password"
leftSection={<TbLock size={16} />}
value={password}
onChange={(e) => setPassword(e.currentTarget.value)}
required
/>
<Divider label="or" labelPosition="center" />
<Button
type="submit"
fullWidth
leftSection={<TbLogin size={18} />}
loading={login.isPending}
mt={4}
style={{
background: 'linear-gradient(135deg, #4f46e5, #7c3aed)',
border: 'none',
}}
>
Sign in
</Button>
<Button
variant="default"
fullWidth
leftSection={<FcGoogle size={18} />}
onClick={() => { window.location.href = '/api/auth/google' }}
>
Continue with Google
</Button>
</Stack>
</form>
</Paper>
</Center>
<Divider label="atau" labelPosition="center" />
<Button
variant="default"
fullWidth
leftSection={<FcGoogle size={18} />}
onClick={() => { window.location.href = '/api/auth/google' }}
>
Continue with Google
</Button>
</Stack>
</form>
</Box>
</Center>
</Box>
)
}