home page done except for export button
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import config from '~config';
|
||||
|
||||
import dbClient from 'db/client.ts';
|
||||
|
||||
interface Plan {
|
||||
@@ -9,7 +11,7 @@ interface Plan {
|
||||
const makePlanButtons = (planId: string, deleted: boolean) =>
|
||||
deleted
|
||||
? `<button onclick="doAction('undelete','${planId}')">restore</button><button onclick="doAction('perm-delete','${planId}')">perm delete</button>`
|
||||
: `<button>open</button><button>share</button><button onclick="doAction('rename','${planId}')">rename</button><button onclick="doAction('move','${planId}')">move</button><button onclick="doAction('delete','${planId}')">delete</button>`;
|
||||
: `<button onclick="openPlan('${planId}')">open</button><button onclick="sharePlan('${planId}')">share</button><button onclick="doAction('rename','${planId}')">rename</button><button onclick="doAction('move','${planId}')">move</button><button onclick="doAction('delete','${planId}')">delete</button>`;
|
||||
|
||||
const makePlanItem = (plan: Plan, deleted: boolean) => `<li>${plan.folder}${plan.folder && '/'}${plan.name} - ${makePlanButtons(plan.id, deleted)}</li>`;
|
||||
|
||||
@@ -43,10 +45,16 @@ const userPIN=prompt('Please enter your PIN:');
|
||||
fetch(\`/api/\${action}/\${planId}\`,{method:actionMethod.get(action),body:JSON.stringify({name:userName,pin:userPIN,folder:newName,planName:newName})})
|
||||
.catch((e)=>{e.text().then((text)=>{alert(text);});})
|
||||
.then((r) => {
|
||||
if(r.status===200){localStorage.setItem('name',userName);r.text().then((text)=>{alert(text);location.reload();});}
|
||||
if(r.status===200){localStorage.setItem('name',userName);r.text().then((text)=>{alert(text);window.location.reload();});}
|
||||
else{r.text().then((text)=>{alert(text);});}
|
||||
});
|
||||
}
|
||||
function openPlan(planId){window.open(\`${config.api.publicDomain}#/share/\${planId}\`);}
|
||||
async function sharePlan(planId){
|
||||
const link=\`${config.api.publicDomain}#/share/\${planId}\`;
|
||||
try{await navigator.clipboard.writeText(link);alert('Link copied to clipboard');}
|
||||
catch (error){prompt('Failed to copy to clipboard, please select and copy the link below:',link);}
|
||||
}
|
||||
</script>
|
||||
<p>This is a very basic management page. Please excuse the number of alert/prompts that will come up when you click on things as it was the quickest way to build it out.</p>
|
||||
<p>Please note: anything modifying data will require you to enter your PIN again as both the web view you are looking at and server behind it are completely stateless for simplicity.</p>
|
||||
|
||||
Reference in New Issue
Block a user