File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 165165 e . preventDefault ( )
166166 if ( ! this . state . newTodo . trim ( ) ) return
167167
168+ const now = Date . now ( )
168169 const newTodos = [
169170 ...this . state . todos ,
170171 {
171- id : Date . now ( ) ,
172+ '@id' : `# ${ Math . floor ( now / 1000 ) } . ${ now % 1000 } ` ,
172173 text : this . state . newTodo ,
173174 completed : false
174175 }
198199 this . saveTodos ( newTodos )
199200 }
200201
202+ openStorageFile = ( ) => {
203+ const pubkey = localStorage . getItem ( 'pubkey' )
204+ if ( pubkey ) {
205+ const url = `https://nosdav.net/${ pubkey } /todos.json`
206+ window . open ( url , '_blank' )
207+ } else {
208+ alert ( 'No pubkey found. Cannot open storage file.' )
209+ }
210+ }
211+
201212 render ( ) {
202213 return html `
203214 < div class ="min-h-screen flex flex-col ">
290301 class ="text-green-600 bg-green-100 rounded-full px-3 py-1 inline-block "
291302 >
292303 Using nosdav cloud storage
304+ < button
305+ onClick =${ this . openStorageFile }
306+ class ="ml-2 bg-blue-500 hover:bg-blue-600 text-white rounded-full px-2 py-0.5 text-xs"
307+ title="Open storage file in new tab"
308+ >
309+ View File
310+ </ button >
293311 </ div > `
294312 : html `< div
295313 class ="text-yellow-600 bg-yellow-100 rounded-full px-3 py-1 inline-block "
You can’t perform that action at this time.
0 commit comments