@@ -37,6 +37,7 @@ import { copyToClipboard } from "@/lib/utils"
3737import { CreateUrlDialog } from "./create-url-dialog"
3838import { type EditDialogState , EditUrlDialog } from "./edit-url-dialog"
3939import { PaginationControls } from "./pagination"
40+ import { QrCodeDialog } from "./qr-code-dialog"
4041import { Toggle } from "./ui/toggle"
4142import { MobileRow , UrlRecordRow } from "./url-record-row"
4243
@@ -59,6 +60,10 @@ export function Dashboard() {
5960
6061 const [ createDialogOpen , setCreateDialogOpen ] = useState ( false )
6162 const [ editDialog , setEditDialog ] = useState < EditDialogState > ( { open : false } )
63+ const [ qrDialog , setQrDialog ] = useState < {
64+ open : boolean
65+ url ?: UrlRecord
66+ } > ( { open : false } )
6267
6368 const handleCustomOnlyToggle = ( ) => {
6469 setQueryParams ( ( prev ) => ( {
@@ -111,15 +116,17 @@ export function Dashboard() {
111116
112117 return (
113118 < div className = "container mx-auto p-6 space-y-6" >
114- < div className = "flex gap-4 items-center" >
115- < Image src = { logo } alt = "PoliNetwork Logo" className = "h-16 w-16" />
116- < div className = "mr-auto gap-2" >
117- < h1 className = "text-3xl font-bold" > polinet.cc</ h1 >
118- < p className = "text-muted-foreground" >
119- PoliNetwork's URL shortener dashboard
120- </ p >
119+ < div className = "flex justify-between gap-4 items-center max-md:flex-col" >
120+ < div className = "flex items-center gap-4" >
121+ < Image src = { logo } alt = "PoliNetwork Logo" className = "h-16 w-16" />
122+ < div className = "gap-2" >
123+ < h1 className = "text-3xl font-bold" > polinet.cc</ h1 >
124+ < p className = "text-muted-foreground max-md:text-sm" >
125+ PoliNetwork's URL shortener dashboard
126+ </ p >
127+ </ div >
121128 </ div >
122- < div className = "flex gap-4" >
129+ < div className = "flex justify-end gap-4 max-md:gap-2 flex-wrap " >
123130 < a
124131 href = "https://github.com/PoliNetworkOrg/polinet.cc"
125132 className = "underline flex items-center gap-1"
@@ -141,18 +148,7 @@ export function Dashboard() {
141148 < span > API Docs</ span >
142149 </ Button >
143150 </ Link >
144- < Button
145- size = "icon-lg"
146- className = "md:hidden"
147- onClick = { ( ) => setCreateDialogOpen ( true ) }
148- >
149- < Plus />
150- </ Button >
151- < Button
152- size = "lg"
153- className = "max-md:hidden"
154- onClick = { ( ) => setCreateDialogOpen ( true ) }
155- >
151+ < Button size = "lg" onClick = { ( ) => setCreateDialogOpen ( true ) } >
156152 < Plus />
157153 < span > Create Short URL</ span >
158154 </ Button >
@@ -178,9 +174,9 @@ export function Dashboard() {
178174 className = "pl-9"
179175 />
180176 </ div >
181- < div className = "flex gap-4 items-center justify-between max-md:w-full max-md:order-3" >
177+ < div className = "flex gap-4 items-center justify-between max-md:w-full max-md:order-3 flex-wrap " >
182178 < Select value = { currentSort } onValueChange = { handleSortChange } >
183- < SelectTrigger className = "w-[170px] max-md: flex-1 " >
179+ < SelectTrigger className = "w-[170px] flex-100 " >
184180 < SelectValue placeholder = "Sort by" />
185181 </ SelectTrigger >
186182 < SelectContent >
@@ -201,7 +197,7 @@ export function Dashboard() {
201197 pressed = { queryParams . customOnly }
202198 onPressedChange = { handleCustomOnlyToggle }
203199 variant = "outline"
204- className = "data-[state=on]:*:[svg]:fill-yellow-300 data-[state=on]:*:[svg]:stroke-yellow-300"
200+ className = "data-[state=on]:*:[svg]:fill-yellow-300 data-[state=on]:*:[svg]:stroke-yellow-300 flex-[1_0_auto] "
205201 >
206202 < Star className = "h-4 w-4" />
207203 Show Custom Only
@@ -230,6 +226,7 @@ export function Dashboard() {
230226 }
231227 onDelete = { ( url ) => handleDelete ( url . short_code ) }
232228 onEdit = { ( url ) => setEditDialog ( { open : true , url } ) }
229+ onQrCode = { ( url ) => setQrDialog ( { open : true , url } ) }
233230 />
234231 ) ) }
235232 </ div >
@@ -256,6 +253,7 @@ export function Dashboard() {
256253 }
257254 onDelete = { ( url ) => handleDelete ( url . short_code ) }
258255 onEdit = { ( url ) => setEditDialog ( { open : true , url } ) }
256+ onQrCode = { ( url ) => setQrDialog ( { open : true , url } ) }
259257 />
260258 ) ) }
261259 </ TableBody >
@@ -304,6 +302,12 @@ export function Dashboard() {
304302 setEditDialog ( { open : false } )
305303 } }
306304 />
305+
306+ < QrCodeDialog
307+ open = { qrDialog . open }
308+ url = { qrDialog . url }
309+ onOpenChange = { ( open ) => setQrDialog ( ( prev ) => ( { ...prev , open } ) ) }
310+ />
307311 </ div >
308312 )
309313}
0 commit comments