diff --git a/package.json b/package.json index dbe281f..e2482cd 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "cross-env": "^7.0.3", "encoding": "^0.1.13", "express": "^4.17.1", - "libphonenumber-js": "^1.9.12", "netlify-lambda": "^2.0.3", "node-fetch": "^2.6.1", "polka": "next", @@ -45,7 +44,6 @@ "sapper": "^0.28.0", "svelte": "^3.35.0", "svelte-preprocess": "^4.6.9", - "svelte-typewriter": "^2.4.5", "tailwindcss": "^2.0.3" } } diff --git a/src/components/Button.svelte b/src/components/Button.svelte deleted file mode 100644 index ebce0c9..0000000 --- a/src/components/Button.svelte +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/components/Container.svelte b/src/components/Container.svelte deleted file mode 100644 index 77ba795..0000000 --- a/src/components/Container.svelte +++ /dev/null @@ -1,7 +0,0 @@ - - -
- -
diff --git a/src/components/Error.svelte b/src/components/Error.svelte deleted file mode 100644 index db35481..0000000 --- a/src/components/Error.svelte +++ /dev/null @@ -1,8 +0,0 @@ - - -{#if visible} -
{errorMessage}
-{/if} \ No newline at end of file diff --git a/src/components/Grid.svelte b/src/components/Grid.svelte deleted file mode 100644 index d358b7a..0000000 --- a/src/components/Grid.svelte +++ /dev/null @@ -1,3 +0,0 @@ -
- -
\ No newline at end of file diff --git a/src/components/Header.svelte b/src/components/Header.svelte index 1a3300a..bd7cd41 100644 --- a/src/components/Header.svelte +++ b/src/components/Header.svelte @@ -5,7 +5,7 @@ export let title = null; -
+
PVD Things diff --git a/src/components/Heading.svelte b/src/components/Heading.svelte deleted file mode 100644 index 4cb71c6..0000000 --- a/src/components/Heading.svelte +++ /dev/null @@ -1,31 +0,0 @@ - - -

- -

- - \ No newline at end of file diff --git a/src/components/Section.svelte b/src/components/Section.svelte deleted file mode 100644 index e75984c..0000000 --- a/src/components/Section.svelte +++ /dev/null @@ -1,13 +0,0 @@ - - -
-
- - - -
-
\ No newline at end of file diff --git a/src/components/Spacer.svelte b/src/components/Spacer.svelte deleted file mode 100644 index e980c1f..0000000 --- a/src/components/Spacer.svelte +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/src/components/Spanner.svelte b/src/components/Spanner.svelte deleted file mode 100644 index 28b2c55..0000000 --- a/src/components/Spanner.svelte +++ /dev/null @@ -1,14 +0,0 @@ - - -
- -
- - \ No newline at end of file diff --git a/src/components/Subheading.svelte b/src/components/Subheading.svelte deleted file mode 100644 index 165f912..0000000 --- a/src/components/Subheading.svelte +++ /dev/null @@ -1,22 +0,0 @@ - - -

- -

- - \ No newline at end of file diff --git a/src/components/Terminal.svelte b/src/components/Terminal.svelte deleted file mode 100644 index b8ad7f3..0000000 --- a/src/components/Terminal.svelte +++ /dev/null @@ -1,14 +0,0 @@ - - - - > - - - - - - \ No newline at end of file diff --git a/src/lib/phone.js b/src/lib/phone.js deleted file mode 100644 index fd2366c..0000000 --- a/src/lib/phone.js +++ /dev/null @@ -1,21 +0,0 @@ -import { parsePhoneNumberFromString, AsYouType } from 'libphonenumber-js'; - -export default class Phone { - constructor(phoneString) { - this.phone = parsePhoneNumberFromString(phoneString, 'US'); - } - - isValid() { - return this.phone.isValid(); - } - - asNumber() { - return this.phone.number; - } - - static formatted(phoneString) { - if (phoneString.length > 6) - return new AsYouType('US').input(phoneString); - return phoneString; - } -} \ No newline at end of file diff --git a/src/routes/_api/things.js b/src/routes/_api/things.js new file mode 100644 index 0000000..245ee3d --- /dev/null +++ b/src/routes/_api/things.js @@ -0,0 +1,29 @@ +async function getAll() { + let data; + let now = new Date(); + + let previousRefresh = new Date(localStorage.getItem("previousRefresh")); + if (Math.abs(now - previousRefresh) > 120000) { + data = _getAll(); + localStorage.setItem("previousRefresh", now.toUTCString()); + } else { + data = JSON.parse(localStorage.getItem("data")); + + console.log('Previous data refreshed.'); + } + + return data; +} + +async function _getAll() { + const result = await fetch(`/.netlify/functions/things`); + let data = await result.json(); + localStorage.setItem("data", JSON.stringify(data)); + + console.log('Refreshed data from API.'); + return data; +} + +export default { + getAll +} \ No newline at end of file diff --git a/src/routes/_layout.svelte b/src/routes/_layout.svelte index 462e8c5..e59361a 100644 --- a/src/routes/_layout.svelte +++ b/src/routes/_layout.svelte @@ -1,11 +1,9 @@ -
diff --git a/src/routes/browse.svelte b/src/routes/browse.svelte deleted file mode 100644 index 6545752..0000000 --- a/src/routes/browse.svelte +++ /dev/null @@ -1,87 +0,0 @@ - - -
- -
-
- {#if !data} - loading... - {:else} - - {#if searchResults.length === 0} - {#each data.categories as category} -
- - {category} - - -
- {/each} - {:else} -
- - Things: - - -
- {/if} - {/if} -
diff --git a/src/routes/donations.svelte b/src/routes/donations.svelte deleted file mode 100644 index 6dc4293..0000000 --- a/src/routes/donations.svelte +++ /dev/null @@ -1,51 +0,0 @@ - - - - - -
-
- -
- Have a Thing to donate? - As a nonprofit organization in the early startup phase, Thing donations are very much appreciated. Click the button below to fill out our donation form. -
-
- -
-
-
-
- -
- Have money to donate? - We would eventually like to be 100% member-funded. But as we're starting up, we need community support. If you can afford to make a donation, it would be very much appreciated. -
-
- -
-
-
- \ No newline at end of file diff --git a/src/routes/index.svelte b/src/routes/index.svelte index 0554a7e..0d01d37 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -1,156 +1,57 @@ + onMount(async () => { + data = await things.getAll(); + }); + + function filterThings(category) { + return data.things.filter(thing => thing.categories.includes(category)); + } + + function search() { + if (searchText.length === 0) { + searchResults = []; + return; + } - + const filtered = data.things.filter(thing => thing.name.toLowerCase().includes(searchText.toLowerCase())); + + if (filtered.length > 0) + searchResults = filtered; + } + - -
- - PVD Things logo -

PVD Things

-
-
-
- - Own Things
Together!
- - - For those things you only sometimes need, why not share them? - - - As a member of the Providence Library of Things, you will have - access to loads of useful things without ever paying the full price. - - -
-
-
- - - Audio Equipment - Cleaning Tools - Musical Instruments - Cooking Supplies - Any Thing. - - The best things in life are Things. Become a co-op member and never pay rent to use Things like these: - - {#if things} - {#each things as thing} - - {thing.name} - - {thing.name} - {thing.categories[0]} - - - {/each} - {/if} - - -
-
- - How will the Library work? - -
- Become a member - Join and reserve - Become a dues-paying member and reserve a Thing from our app. -
-
- People using tools - Use and return - Pick up the Thing you reserved and bring it back when you're done with it. -
-
- Get involved - Get involved! - Elect the Board of Directors, participate in Library meetings, and vote on the Things we share. -
-
-
-
-
- - But we need your help. -
- Location. - Location for tool libraries is always the biggest hurdle. Rent, especially in and around a city, is -- let's face it -- absurd. If you know of any low-cost opportunities in PVD, please don't hesitate to let us know. We're open to storefront space, a warehouse, or even an open field. -
-
- Things. - Though we will be purchasing new Things for the library, donations will go a long way toward getting us to financial sustainability while offering every Thing the co-op members may need. -
-
- Spreading the word. - More members means a stronger cooperative! The more who join, the faster we'll have a thriving community and lots of Things to use. -
-
-
-
- - - 150+ - prospective members - - - 15+ - things donated - - -
-
- Ready to co-own Things? - - The Providence Library of Things hasn't launched yet, but you - can help make it happen. Join our waiting list to help us start up! - - - - - - - - - -
-
+
+ +
+
+ {#if !data} + loading... + {:else} + {#if searchResults.length === 0} + {#each data.categories as category} +
+
{category}
+ +
+ {/each} + {:else} +
+ +
+ {/if} + {/if} +
diff --git a/static/bpimperial.italic-webfont.woff b/static/bpimperial.italic-webfont.woff new file mode 100644 index 0000000..033ed3a Binary files /dev/null and b/static/bpimperial.italic-webfont.woff differ diff --git a/static/fonts.css b/static/fonts.css index 548e936..426564e 100644 --- a/static/fonts.css +++ b/static/fonts.css @@ -1 +1,6 @@ -@import url('https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,400;0,700;1,400;1,700&family=Roboto+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap'); \ No newline at end of file +@import url('https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,400;0,700;1,400;1,700&family=Roboto+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap'); + +@font-face { + font-family: "bpimperial"; + src: url("/bpimperial.italic-webfont.woff") format("woff"); +} \ No newline at end of file diff --git a/tailwind.config.js b/tailwind.config.js index ddf920e..4264453 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -18,8 +18,11 @@ module.exports = { }, theme: { extend: { + fontFamily: { + display: ['bpimperial'] + }, colors: { - primary: "#fdd835", + primary: "#ffde59", bg: "#282828" }, height: {