-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from taleeus/dev
feat(merch): added bigcartel integration, feat(images): added lazy images
- Loading branch information
Showing
81 changed files
with
237 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script setup lang="ts"> | ||
defineProps<{ | ||
src: string; | ||
placeholder: string; | ||
alt?: string; | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<v-lazy-image | ||
:src="src" | ||
:src-placeholder="placeholder" | ||
:alt="alt" | ||
></v-lazy-image> | ||
</template> | ||
|
||
<style scoped> | ||
.v-lazy-image { | ||
filter: blur(5px); | ||
transition: filter 0.5s; | ||
will-change: filter; | ||
} | ||
.v-lazy-image-loaded { | ||
filter: blur(0); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module 'v-lazy-image' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import axios from "axios"; | ||
import { defineStore } from "pinia"; | ||
import { ref } from "vue"; | ||
import { DataAttributes, Product, Response } from "../types/bigcartel.types"; | ||
import { Merch } from "../types/merch.types"; | ||
|
||
export const useBigcartelStore = defineStore("bigcartel", () => { | ||
const merch = ref<Merch[]>([]); | ||
const fetchMerch = async () => { | ||
const accountId = import.meta.env.VITE_BIGCARTEL_ACCOUNT_ID; | ||
const response = await axios.get( | ||
`https://api.bigcartel.com/v1/accounts/${accountId}/products`, | ||
{ | ||
auth: { | ||
username: import.meta.env.VITE_BIGCARTEL_USERNAME, | ||
password: import.meta.env.VITE_BIGCARTEL_PASSWORD, | ||
}, | ||
headers: { | ||
'Accept': 'application/vnd.api+json', | ||
'Content-Type': 'application/vnd.api+json', | ||
} | ||
}, | ||
); | ||
|
||
const bigcartelResponse = response.data as Response<Product>; | ||
merch.value = (bigcartelResponse.data as DataAttributes<Product>[]).map((e) => ({ | ||
name: e.attributes.name, | ||
description: e.attributes.description, | ||
price: `€ ${Number.parseFloat(e.attributes.default_price).toFixed(2)}`, | ||
position: e.attributes.position, | ||
url: e.attributes.url, | ||
imageUrl: e.attributes.primary_image_url, | ||
onSale: e.attributes.on_sale, | ||
})); | ||
|
||
return merch; | ||
}; | ||
|
||
|
||
fetchMerch(); | ||
return { merch, fetchMerch }; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export interface DataAttributes<T> { | ||
attributes: T; | ||
} | ||
|
||
export interface Response<T> { | ||
data: DataAttributes<T> | DataAttributes<T>[]; | ||
} | ||
|
||
export interface Product { | ||
name: string; | ||
description?: string; | ||
default_price: string; | ||
position: number; | ||
url: string; | ||
primary_image_url: string; | ||
on_sale: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export interface Merch { | ||
name: string; | ||
description?: string; | ||
price: string; | ||
position: number; | ||
url: string; | ||
imageUrl: string; | ||
onSale: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
export function not(predicate: Function) { | ||
return function (this: Function) { | ||
return !predicate.apply(this, arguments); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.