Skip to content

Commit

Permalink
initial commit on prod/dev environment TODO: bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeoooo committed Dec 27, 2023
1 parent 43da743 commit ea5fc92
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 6 deletions.
14 changes: 13 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"type": "module",
"dependencies": {
"d3": "^7.8.5",
"dotenv": "^16.3.1",
"layercake": "^8.0.2",
"node-fetch": "^3.3.2"
}
}
}
Binary file modified pb_data/logs.db
Binary file not shown.
7 changes: 6 additions & 1 deletion src/lib/components/WebsiteCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@
export let website_name = 'website_name';
export let website_description = 'website_description';
export let status;
const baseUrl =
process.env.NODE_ENV === 'production'
? process.env.PRODUCTION_INSTANCE
: process.env.LOCAL_INSTANCE;
</script>

<div
class="overflow-hidden bg-white border border-black h-[250px] w-full relative shadow-lg transition ease-in-out hover:scale-105 hover:z-40"
>
<img
class="absolute -right-14 h-96 opacity-5"
src="http://127.0.0.1:8090/api/files/{collectionId}/{id}/{logo}"
src="${baseUrl}files/{collectionId}/{id}/{logo}"
alt=""
srcset=""
style=""
Expand Down
12 changes: 10 additions & 2 deletions src/routes/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import type { PageServerLoad } from './$types';
import { LOCAL_INSTANCE } from '$env/static/private';
import 'dotenv/config';
import fetch from 'node-fetch';

export const load: PageServerLoad = async () => {
const baseUrl =
process.env.NODE_ENV === 'production'
? process.env.PRODUCTION_INSTANCE
: process.env.LOCAL_INSTANCE;

// check what instance did we use
console.log(`Using base URL: ${baseUrl}`);

const websites_response = await fetch(
'http://127.0.0.1:8090/api/collections/websites/records?expand=websites&sort=school_name'
`${baseUrl}collections/websites/records?expand=websites&sort=school_name`
);

const websites_data: any = await websites_response.json();
Expand Down
7 changes: 6 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
// Display the result
// console.log(allWebsites);
const baseUrl =
process.env.NODE_ENV === 'production'
? process.env.PRODUCTION_INSTANCE
: process.env.LOCAL_INSTANCE;
</script>

<body class="flex flex-col w-full h-full mb-auto bg-slate-100">
Expand All @@ -79,7 +84,7 @@
<div class="flex flex-row h-auto items-center">
<img
class="mx-4 h-32 my-2"
src="http://127.0.0.1:8090/api/files/{data.collectionId}/{data.id}/{data.logo}"
src="${baseUrl}files/{data.collectionId}/{data.id}/{data.logo}"
alt=""
srcset=""
/>
Expand Down

0 comments on commit ea5fc92

Please sign in to comment.