-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5fa709
commit 0c7992a
Showing
29 changed files
with
810 additions
and
167 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: [menthorlabs] |
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,51 @@ | ||
<script setup lang="ts"> | ||
defineProps<{ | ||
fileUrl: string; | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<div | ||
v-if="fileUrl === 'loading'" | ||
class="flex items-center justify-center w-full aspect-video bg-zinc-100 animate-pulse" | ||
> | ||
<svg | ||
class="w-10 h-10 text-zinc-200" | ||
aria-hidden="true" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="currentColor" | ||
viewBox="0 0 20 18" | ||
> | ||
<path | ||
d="M18 0H2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2Zm-5.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm4.376 10.481A1 1 0 0 1 16 15H4a1 1 0 0 1-.895-1.447l3.5-7A1 1 0 0 1 7.468 6a.965.965 0 0 1 .9.5l2.775 4.757 1.546-1.887a1 1 0 0 1 1.618.1l2.541 4a1 1 0 0 1 .028 1.011Z" | ||
/> | ||
</svg> | ||
</div> | ||
<div v-else class="relative group"> | ||
<div | ||
class="absolute top-2 right-2 z-20 hidden group-hover:flex items-center gap-1" | ||
> | ||
<nuxt-link external target="_blank" :to="fileUrl"> | ||
<MIconButton icon="external-link-alt" class="!text-white" /> | ||
</nuxt-link> | ||
<MIconButton icon="times" class="!text-white" /> | ||
</div> | ||
|
||
<div | ||
class="absolute z-10 top-0 left-0 w-full h-full items-center justify-center bg-black/50 cursor-pointer hidden group-hover:flex" | ||
> | ||
<span class="font-semibold text-sm text-white"> Copiar url </span> | ||
</div> | ||
<div class="aspect-video w-full overflow-hidden bg-zinc-100"> | ||
<nuxt-img | ||
:src="fileUrl" | ||
:quality="85" | ||
format="webp" | ||
width="250" | ||
height="140" | ||
alt="Roadmap" | ||
class="h-full w-full object-cover object-center transition-all group-hover:scale-110" | ||
/> | ||
</div> | ||
</div> | ||
</template> |
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,63 @@ | ||
import { defineStore } from "pinia"; | ||
|
||
export const useCreatorsStore = defineStore("creators", { | ||
state: (): { | ||
images: string[]; | ||
filesSize: number; | ||
} => ({ | ||
images: [], | ||
filesSize: 0, | ||
}), | ||
actions: { | ||
async getImages() { | ||
try { | ||
const response = await this.$api(`/creators/images`); | ||
this.images = response.images; | ||
this.filesSize = response.filesSize; | ||
return response; | ||
} catch (e) { | ||
throw new Error((e as Error).message); | ||
} | ||
}, | ||
async signUrl(fileType: string) { | ||
try { | ||
const response = await this.$api(`/creators/images/sign-url`, { | ||
method: "POST", | ||
body: { | ||
fileType, | ||
}, | ||
}); | ||
|
||
return response; | ||
} catch (e) { | ||
throw new Error((e as Error).message); | ||
} | ||
}, | ||
async deleteImage(fileName: string) { | ||
try { | ||
await this.$api(`/creators/${fileName}`, { | ||
method: "DELETE", | ||
}); | ||
|
||
if (this.images.length <= 0) return; | ||
this.images = this.images.filter((e) => e != fileName); | ||
} catch (e) { | ||
throw new Error((e as Error).message); | ||
} | ||
}, | ||
async addImage(fileName: string) { | ||
try { | ||
await this.$api(`/creators/images`, { | ||
method: "POST", | ||
body: { | ||
url: fileName, | ||
}, | ||
}); | ||
|
||
this.images.push(fileName); | ||
} catch (e) { | ||
throw new Error((e as Error).message); | ||
} | ||
}, | ||
}, | ||
}); |
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,21 @@ | ||
import { defineStore } from "pinia"; | ||
|
||
export const useUploadStore = defineStore("upload", { | ||
actions: { | ||
async uploadFileOnUrl(file: File, url: string) { | ||
try { | ||
const response = await $fetch(url, { | ||
method: "PUT", | ||
body: file, | ||
headers: { | ||
"Content-Type": file.type, | ||
}, | ||
}); | ||
|
||
return response; | ||
} catch (e) { | ||
throw new Error((e as Error).message); | ||
} | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.