Skip to content

Commit

Permalink
Merge pull request #12 from shaniit-org/dev
Browse files Browse the repository at this point in the history
Minor fix and tweaks
  • Loading branch information
Riley1101 authored Nov 25, 2023
2 parents b6a694e + e318f60 commit 431fc21
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
1 change: 1 addition & 0 deletions dateSync.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 2 additions & 2 deletions src/lib/components/common/ArticleBanner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
{#if authors}
{#each authors as aut}
<div class="flex items-center gap-4 flex-row">
<div class="w-[60px] aspect-square bg-gray-800 h-[60px]">
<div class="w-[60px] aspect-square bg-gray-800 h-[60px] rounded-full">
<SanityImage
maxWidth={80}
image={aut.profile}
className="w-[60px] h-[60px] object-cover"
className="w-[60px] h-[60px] object-cover rounded-full"
/>
</div>
<div class="flex flex-col">
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/common/FloatingDonate.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<ImageLoader
src="/images/donate.png"
alt="donate"
class="max-w-max mx-auto min-h-[50px] min-w-[50px]"
class="mx-auto h-[50px] w-[50px] max-w-max"
/>
<p class="text-sm my-4 leading-relaxed">
တွၼ်ႈတႃႇ ၵၢၼ်ဢၢႆႇထီႇတႆး တေၶိုၼ်ႈယႂ်ႇၼၼ်ႉ... လူဝ်ႇတၢင်းၸွႆႈထႅမ်သူၸဝ်ႈယူႇ။
Expand Down
32 changes: 32 additions & 0 deletions src/routes/api/terms/+server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/** @type {import('./$types').RequestHandler} */
export async function GET() {
/*
const query = `{
'term': *[_type == 'random_terms'][0..10]{title,description,slug,_createdAt},
}`;
// create file named dateSync
const file = `dateSync`;
const fileExists = fs.existsSync(file);
if (!fileExists) {
fs.writeFileSync(file, new Date().toISOString());
}
// get time difference between now and last sync
let lastSync = fs.readFileSync(file, 'utf8');
let lastSyncDate = new Date(lastSync);
let now = new Date();
let diff = now.getTime() - lastSyncDate.getTime();
let diffHours = Math.floor(diff / 1000 / 60 / 60);
// if more than 24 hours, sync
if (diffHours > 24) {
console.log('syncing');
}
console.log('not syncing');
// if less than 24 hours, do nothing
*/
return new Response(
JSON.stringify({
status: 200,
body: 'term'
})
);
}

0 comments on commit 431fc21

Please sign in to comment.