From 4a0d88a2a5d2bd09b4d25cf62912e892b8e28a8b Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Tue, 26 Mar 2024 23:57:26 +0000 Subject: [PATCH] Adds inventory feature --- web/public/robots.txt | 2 + web/src/components/form/EditableTitle.svelte | 82 ++++++++++++ web/src/components/form/FontAwesome.svelte | 1 + .../components/things/DeleteListing.svelte | 3 +- .../components/things/GetSharableLink.svelte | 82 ++++++++++++ web/src/components/things/SaveListing.svelte | 93 ++++++++++++++ .../components/things/SavedServices.svelte | 89 +++++++++++++ web/src/components/things/ServiceCard.astro | 119 ++---------------- web/src/components/things/ServiceCard.svelte | 69 ++++++++++ web/src/components/things/ServiceList.astro | 21 +++- web/src/components/things/service-card.scss | 110 ++++++++++++++++ web/src/pages/[...listing].astro | 17 ++- web/src/pages/all.astro | 19 +-- web/src/pages/browse.astro | 2 +- web/src/pages/index.astro | 5 + .../pages/inventory/[...inventoryId].astro | 101 +++++++++++++++ web/src/pages/inventory/index.astro | 61 +++++++++ web/src/pages/sitemap.astro | 15 ++- 18 files changed, 765 insertions(+), 126 deletions(-) create mode 100644 web/src/components/form/EditableTitle.svelte create mode 100644 web/src/components/things/GetSharableLink.svelte create mode 100644 web/src/components/things/SaveListing.svelte create mode 100644 web/src/components/things/SavedServices.svelte create mode 100644 web/src/components/things/ServiceCard.svelte create mode 100644 web/src/components/things/service-card.scss create mode 100644 web/src/pages/inventory/[...inventoryId].astro create mode 100644 web/src/pages/inventory/index.astro diff --git a/web/public/robots.txt b/web/public/robots.txt index b65f9b3..b7656f4 100644 --- a/web/public/robots.txt +++ b/web/public/robots.txt @@ -1,6 +1,8 @@ User-agent: * Disallow: /search/* +Disallow: /inventory/* Allow: /search/$ +Allow: /inventory/$ Allow: /sitemap Sitemap: https://awesome-privacy.xyz/sitemap-index.xml diff --git a/web/src/components/form/EditableTitle.svelte b/web/src/components/form/EditableTitle.svelte new file mode 100644 index 0000000..ee9b999 --- /dev/null +++ b/web/src/components/form/EditableTitle.svelte @@ -0,0 +1,82 @@ + + + + + +
+

editing = true} + on:keydown={handleKeydown} + on:blur={() => saveTitle(title)} + tabindex="0" +>{title}

+ +Click the title, to edit your inventory name +
+ + diff --git a/web/src/components/form/FontAwesome.svelte b/web/src/components/form/FontAwesome.svelte index b0e54a2..4074407 100644 --- a/web/src/components/form/FontAwesome.svelte +++ b/web/src/components/form/FontAwesome.svelte @@ -78,6 +78,7 @@ //Misc ratingStar: solidIcons.faStar, + saveListing: solidIcons.faBookmark }; export let iconName: string; diff --git a/web/src/components/things/DeleteListing.svelte b/web/src/components/things/DeleteListing.svelte index 07ec713..2e825d0 100644 --- a/web/src/components/things/DeleteListing.svelte +++ b/web/src/components/things/DeleteListing.svelte @@ -40,7 +40,7 @@ diff --git a/web/src/components/things/SaveListing.svelte b/web/src/components/things/SaveListing.svelte new file mode 100644 index 0000000..9df2493 --- /dev/null +++ b/web/src/components/things/SaveListing.svelte @@ -0,0 +1,93 @@ + + + + + diff --git a/web/src/components/things/SavedServices.svelte b/web/src/components/things/SavedServices.svelte new file mode 100644 index 0000000..214c498 --- /dev/null +++ b/web/src/components/things/SavedServices.svelte @@ -0,0 +1,89 @@ + + +
+ {#if $savedServices.length > 0} +
+ {#each $savedServices as thingy} + + {/each} +
+ {:else if !serviceList} +
+

Here you'll find a list of all the software and services you've bookmarked.

+ + All data is stored on-device, in your browser's local storage, + and not sent anywhere unless you choose to share it + +

Nothing saved yet!

+
+ {/if} +
+ + diff --git a/web/src/components/things/ServiceCard.astro b/web/src/components/things/ServiceCard.astro index d2c84d6..f7756f5 100644 --- a/web/src/components/things/ServiceCard.astro +++ b/web/src/components/things/ServiceCard.astro @@ -3,6 +3,7 @@ import { formatLink } from '@utils/parse-markdown'; import type { Service } from 'src/types/Service'; import FontAwesome from '@components/form/FontAwesome.svelte'; +import SaveListing from '@components/things/SaveListing.svelte'; import { slugify } from '@utils/fetch-data'; interface Props { @@ -39,7 +40,6 @@ const {
- +
+ +
+
- - + diff --git a/web/src/components/things/ServiceCard.svelte b/web/src/components/things/ServiceCard.svelte new file mode 100644 index 0000000..d76be99 --- /dev/null +++ b/web/src/components/things/ServiceCard.svelte @@ -0,0 +1,69 @@ + + +
+
+ +

{service.name}

+
+ {#if service.followWith} + + {/if} +
+ +
+ +
+ +
+ {`${service.name} +
+

{@html service.description}

+
+
+ + +
+ + diff --git a/web/src/components/things/ServiceList.astro b/web/src/components/things/ServiceList.astro index 00853e1..aeabc20 100644 --- a/web/src/components/things/ServiceList.astro +++ b/web/src/components/things/ServiceList.astro @@ -8,6 +8,7 @@ import DeleteListing from '@components/things/DeleteListing.svelte'; import { slugify } from '@utils/fetch-data'; import GitHubMetrics from '@components/things/ItemGitHubMetrics.astro'; +import SaveListing from '@components/things/SaveListing.svelte'; interface Props { services: Service[]; @@ -54,6 +55,13 @@ const { {services.map((service: Service) => (
  • +
    + +
    diff --git a/web/src/components/things/service-card.scss b/web/src/components/things/service-card.scss new file mode 100644 index 0000000..ca97b18 --- /dev/null +++ b/web/src/components/things/service-card.scss @@ -0,0 +1,110 @@ +.service { + display: flex; + flex-direction: column; + padding: 1rem; + border: 2px solid var(--box-outline); + box-shadow: 6px 6px 0 var(--box-outline); + background: var(--accent-fg); + border-radius: var(--curve-sm); + position: relative; + overflow: hidden; + + .service-head { + display: flex; + align-items: center; + gap: 0.5rem; + h4 { + margin: 0; + font-size: 1.4rem; + color: var(--foreground); + } + p { + margin: 0; + font-size: 1rem; + opacity: 0.7; + } + a { + text-decoration: none; + } + h4 { + text-decoration: none; + position: relative; + &:after { + background: none repeat scroll 0 0 transparent; + bottom: 0; + content: ""; + display: block; + height: 3px; + left: 50%; + position: absolute; + background: var(--accent-3); + transition: width 0.2s ease 0s, left 0.2s ease 0s; + width: 0; + } + &:hover:after { + width: 100%; + left: 0; + } + } + } + + .save-listing { + position: absolute; + top: 0.5rem; + right: 0.5rem; + } + + .service-body { + display: flex; + align-items: center; + gap: 0.5rem; + img { + border-radius: var(--curve-sm); + font-size: 0.6rem; + color: var(--accent); + } + :global(p) { + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + overflow: hidden; + margin: 0.5rem 0; + width: calc(100% - 2rem); + overflow-x: hidden; + } + } + + .service-links { + display: flex; + gap: 0.5rem; + justify-content: space-between; + a { + color: var(--accent-3); + font-size: 0.8rem; + display: inline-flex; + align-items: center; + gap: 0.25rem; + opacity: 0.85; + text-decoration: none; + max-width: 50%; + min-width: 25%; + &:not(:last-child) { + margin-right: 0.5rem; + } + &:hover { + text-decoration: underline; + opacity: 1; + } + :global(svg) { + width: 1rem; + height: 1rem; + } + span { + max-width: calc(100% - 1rem); + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + } + } +} diff --git a/web/src/pages/[...listing].astro b/web/src/pages/[...listing].astro index af34858..b44913e 100644 --- a/web/src/pages/[...listing].astro +++ b/web/src/pages/[...listing].astro @@ -25,6 +25,7 @@ import { parseMarkdown, formatLink } from '@utils/parse-markdown'; import { site } from '@utils/config'; import FontAwesome from '@components/form/FontAwesome.svelte'; import Button from '@components/form/Button.astro'; +import SaveListing from '@components/things/SaveListing.svelte'; interface Props extends Service { slug: string; @@ -184,7 +185,15 @@ const getApiEndpoint = () => { ➔ {parentSection.name}{name} -
    +
  • +
    + +
    {

    ⚠️ This section is still a work in progress ⚠️
    Check back soon, or help us complete it by submiting a pull request on GitHub. +
    + Or submit an entry here

    ) : null} @@ -119,10 +121,6 @@ main { justify-content: space-between; } -// .narrow { -// width: 70%; -// } - .hidden { display: none; } @@ -243,22 +241,25 @@ h3 { } .nothing-yet { - width: 80vw; + width: 100%; margin: 0 auto; background: var(--accent-fg); border: 2px solid var(--box-outline); box-shadow: 6px 6px 0 var(--box-outline); border-radius: var(--curve-sm); - display: flex; - width: 80vw; - max-width: 28rem; + p { font-size: 1.2rem; opacity: 0.8; font-style: italic; text-align: center; - margin-bottom: 3rem; + margin: 4rem auto; + } + .quick-submit { + margin-top: 1rem; + font-size: 0.8rem; + opacity: 0.8; } } diff --git a/web/src/pages/browse.astro b/web/src/pages/browse.astro index e824a7e..9f30a76 100644 --- a/web/src/pages/browse.astro +++ b/web/src/pages/browse.astro @@ -19,7 +19,7 @@ const categories: Category[] = (await fetchData())?.categories;

    Press enter for deep search

    - +