Skip to content

Supabase Storage から Local の管理へ切り替え #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions apps/web/app/components/SpeakerPageSection.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<script setup lang="ts">
import SpeakerCfp from '~/components/speaker/SpeakerCfp.vue'
import { useLocaleCurrent } from '@/composables/useLocaleCurrent'
import { useSupabaseStorage } from '@/composables/useSupabaseStorage'
import type { SpeakerCategory, SpeakerInfo } from '@vuejs-jp/model'
import { useRuntimeConfig } from '#imports'
import { REDIRECT_URL } from '~/utils/environment.constants'

type _SpeakerCategory = Extract<SpeakerCategory, 'sessionSpeakers' | 'lightningTalkSpeakers' | 'sponsorSessionSpeakers'>
type Speakers = Record<_SpeakerCategory, SpeakerInfo>
Expand All @@ -14,6 +16,8 @@ const props = defineProps<{
const config = useRuntimeConfig()
const currentLocale = useLocaleCurrent().locale

const { getStaticAvatarUrl } = useSupabaseStorage()

const { sessionSpeakers, lightningTalkSpeakers, sponsorSessionSpeakers } = props.data as Speakers
</script>

Expand All @@ -32,7 +36,7 @@ const { sessionSpeakers, lightningTalkSpeakers, sponsorSessionSpeakers } = props
:to="`${currentLocale === 'ja' ? '/' : `/${currentLocale}/`}sessions/${speaker.detail_page_id}`"
>
<VFSpeaker
:image="speaker.image_url"
:image="getStaticAvatarUrl(speaker.image_url)"
:company="currentLocale === 'en' ? speaker.company_en : speaker.company_ja"
:division="currentLocale === 'en' ? speaker.position_en : speaker.position_ja"
:name="currentLocale === 'en' ? speaker.name_en : speaker.name_ja"
Expand All @@ -42,7 +46,7 @@ const { sessionSpeakers, lightningTalkSpeakers, sponsorSessionSpeakers } = props
</NuxtLink>
<VFSpeaker
v-else
:image="speaker.image_url"
:image="getStaticAvatarUrl(speaker.image_url)"
:company="currentLocale === 'en' ? speaker.company_en : speaker.company_ja"
:division="currentLocale === 'en' ? speaker.position_en : speaker.position_ja"
:name="currentLocale === 'en' ? speaker.name_en : speaker.name_ja"
Expand All @@ -68,7 +72,7 @@ const { sessionSpeakers, lightningTalkSpeakers, sponsorSessionSpeakers } = props
:to="`${currentLocale === 'ja' ? '/' : `/${currentLocale}/`}sessions/${speaker.detail_page_id}`"
>
<VFSpeaker
:image="speaker.image_url"
:image="getStaticAvatarUrl(speaker.image_url)"
:company="currentLocale === 'en' ? speaker.company_en : speaker.company_ja"
:division="currentLocale === 'en' ? speaker.position_en : speaker.position_ja"
:name="currentLocale === 'en' ? speaker.name_en : speaker.name_ja"
Expand All @@ -78,7 +82,7 @@ const { sessionSpeakers, lightningTalkSpeakers, sponsorSessionSpeakers } = props
</NuxtLink>
<VFSpeaker
v-else
:image="speaker.image_url"
:image="getStaticAvatarUrl(speaker.image_url)"
:company="currentLocale === 'en' ? speaker.company_en : speaker.company_ja"
:division="currentLocale === 'en' ? speaker.position_en : speaker.position_ja"
:name="currentLocale === 'en' ? speaker.name_en : speaker.name_ja"
Expand All @@ -99,7 +103,7 @@ const { sessionSpeakers, lightningTalkSpeakers, sponsorSessionSpeakers } = props
:to="`${currentLocale === 'ja' ? '/' : `/${currentLocale}/`}sessions/${speaker.detail_page_id}`"
>
<VFSpeaker
:image="speaker.image_url"
:image="getStaticAvatarUrl(speaker.image_url)"
:company="currentLocale === 'en' ? speaker.company_en : speaker.company_ja"
:division="currentLocale === 'en' ? speaker.position_en : speaker.position_ja"
:name="currentLocale === 'en' ? speaker.name_en : speaker.name_ja"
Expand All @@ -109,7 +113,7 @@ const { sessionSpeakers, lightningTalkSpeakers, sponsorSessionSpeakers } = props
</NuxtLink>
<VFSpeaker
v-else
:image="speaker.image_url"
:image="getStaticAvatarUrl(speaker.image_url)"
:company="currentLocale === 'en' ? speaker.company_en : speaker.company_ja"
:division="currentLocale === 'en' ? speaker.position_en : speaker.position_ja"
:name="currentLocale === 'en' ? speaker.name_en : speaker.name_ja"
Expand Down
5 changes: 4 additions & 1 deletion apps/web/app/components/event/PanelerList.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<script setup lang="ts">
import type { Speaker } from '@vuejs-jp/model'
import { useLocaleCurrent } from '~/composables/useLocaleCurrent'
import { useSupabaseStorage } from '~/composables/useSupabaseStorage'

interface PanelerListProps {
panelers: Speaker[]
}

const props = defineProps<PanelerListProps>()

const { getStaticAvatarUrl } = useSupabaseStorage()

const currentLocale = useLocaleCurrent().locale
</script>

Expand All @@ -16,7 +19,7 @@ const currentLocale = useLocaleCurrent().locale
<VFSpeaker
v-for="paneler in panelers"
:key="paneler.id"
:image="paneler.image_url"
:image="getStaticAvatarUrl(paneler.image_url)"
:company="currentLocale === 'en' ? paneler.company_en : paneler.company_ja"
:division="currentLocale === 'en' ? paneler.position_en : paneler.position_en"
:name="currentLocale === 'en' ? paneler.name_en : paneler.name_ja"
Expand Down
5 changes: 4 additions & 1 deletion apps/web/app/components/sponsor/SponsorList.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<script setup lang="ts">
import type { PersonalSponsorInfo, SponsorInfo } from '@vuejs-jp/model'
import { useLocaleCurrent } from '~/composables/useLocaleCurrent'
import { useSupabaseStorage } from '~/composables/useSupabaseStorage'

type Props = SponsorInfo & {
personal?: PersonalSponsorInfo
}

defineProps<Props>()

const { getStaticAvatarUrl } = useSupabaseStorage()

const currentLocale = useLocaleCurrent().locale
</script>

Expand All @@ -24,7 +27,7 @@ const currentLocale = useLocaleCurrent().locale
>
<img
class="sponsor-list-item-image"
:src="item['image_url']"
:src="getStaticAvatarUrl(item.image_url)"
:alt="item.name"
loading="lazy"
/>
Expand Down
5 changes: 2 additions & 3 deletions apps/web/app/components/ticket/NamecardSection.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<script setup lang="ts">
import { useLocaleCurrent } from '~/composables/useLocaleCurrent'
import { endedApplyNormal, endedCreateNamecard, ticketUrl } from '~/utils/constants'
import { endedApplyNormal, endedCreateNamecard, isDone, ticketUrl } from '~/utils/constants'
import { useWithBase, usePathWithLocale } from '#imports'

const { locale: currentLocale } = useLocaleCurrent()
const basePath = useWithBase()
const pathWithLocale = usePathWithLocale()
</script>
Expand Down Expand Up @@ -39,6 +37,7 @@ const pathWithLocale = usePathWithLocale()
:href="pathWithLocale('/namecard')"
background-color="vue-green/200"
color="white"
:disabled="isDone"
>
{{ endedCreateNamecard ? $t('namecard.confirmNamecard') : $t('namecard.createNamecard') }}
</VFLinkButton>
Expand Down
9 changes: 8 additions & 1 deletion apps/web/app/composables/useSupabaseStorage.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import { useRuntimeConfig } from '#imports'
import { bucket } from '@vuejs-jp/model'
import { REDIRECT_URL } from '../utils/environment.constants'

export function useSupabaseStorage() {
const config = useRuntimeConfig()
const { supabaseUrl } = config.public

function getStaticAvatarUrl(avatarUrl?: string) {
if (!avatarUrl) return `${REDIRECT_URL}/supabase/common/default.png`

return `${REDIRECT_URL}/supabase/common/${new URL(avatarUrl).pathname.split('/').pop()}`
}

function getFullAvatarUrl(avatarUrl: string) {
if (!avatarUrl) return `${supabaseUrl}/storage/v1/object/public/${bucket}/default.png`
if (avatarUrl?.startsWith(supabaseUrl)) return avatarUrl
return `${supabaseUrl}/storage/v1/object/public/${bucket}${avatarUrl}`
}

return { getFullAvatarUrl }
return { getStaticAvatarUrl, getFullAvatarUrl }
}
5 changes: 4 additions & 1 deletion apps/web/app/pages/jobboard.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { useFetch, useHead, usePathWithLocale } from '#imports'
import { useSupabaseStorage } from '~/composables/useSupabaseStorage'
import type { JobInfo } from '@vuejs-jp/model'
import { conferenceTitle, linkUrl, ogJobboardDescription } from '~/utils/constants'
import { generalOg, twitterOg } from '~/utils/og.constants'
Expand All @@ -12,6 +13,8 @@ if (error.value) {
}
const { allJobs } = data.value as Jobs

const { getStaticAvatarUrl } = useSupabaseStorage()

const pathWithLocale = usePathWithLocale()

useHead({
Expand Down Expand Up @@ -39,7 +42,7 @@ useHead({
<ul class="jobboard-body">
<li v-for="(job, index) in allJobs.list" :key="index">
<nuxt-link :to="job.link_url" target="_blank">
<img :src="job.image_url" :alt="job.image_alt" />
<img :src="getStaticAvatarUrl(job.image_url)" :alt="job.image_alt" />
</nuxt-link>
</li>
</ul>
Expand Down
4 changes: 3 additions & 1 deletion apps/web/app/pages/sessions/[id]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { Speaker } from '@vuejs-jp/model'
import { useLocaleCurrent } from '~/composables/useLocaleCurrent'
import { useSupabase } from '~/composables/useSupabase'
import { useSession } from '~/composables/useSession'
import { useSupabaseStorage } from '~/composables/useSupabaseStorage'
import { conferenceTitle, linkUrl, ogSpeakerDescription } from '~/utils/constants'
import { generalOg, twitterOg } from '~/utils/og.constants'
import { useRange } from '@vuejs-jp/composable'
Expand All @@ -36,6 +37,7 @@ const { range } = useRange()
const { color, trackName } = useSession()
const currentLocale = useLocaleCurrent().locale
const pathWithLocale = usePathWithLocale()
const { getStaticAvatarUrl } = useSupabaseStorage()

useHead({
titleTemplate: (titleChunk) => `${speakerData[0].session_title_ja} | ${conferenceTitle}`,
Expand Down Expand Up @@ -105,7 +107,7 @@ useHead({

<div class="detailbody-persons">
<VFSpeaker
:image="speakerData[0].image_url"
:image="getStaticAvatarUrl(speakerData[0].image_url)"
:company="currentLocale === 'en' ? speakerData[0].company_en : speakerData[0].company_ja"
:division="
currentLocale === 'en' ? speakerData[0].position_en : speakerData[0].position_ja
Expand Down
5 changes: 4 additions & 1 deletion apps/web/app/pages/sessions/[id]/share.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '#imports'
import { useLocaleCurrent } from '~/composables/useLocaleCurrent'
import { useSupabase } from '~/composables/useSupabase'
import { useSupabaseStorage } from '~/composables/useSupabaseStorage'
import { conferenceTitle, linkUrl, ogSpeakerDescription } from '~/utils/constants'
import { generalOg, twitterOg } from '~/utils/og.constants'
import type { Speaker } from '@vuejs-jp/model'
Expand All @@ -32,6 +33,8 @@ if (!speakerData[0].detail_page_id) {

const currentLocale = useLocaleCurrent().locale

const { getStaticAvatarUrl } = useSupabaseStorage()

function copyUrl() {
const element = document.createElement('input')
element.value = `https://vuefes.jp/2024/namecard/${id}/share`
Expand Down Expand Up @@ -73,7 +76,7 @@ useHead({
class="session"
:user="{
display_name: speakerData[0].name_ja,
avatar_url: speakerData[0].image_url,
avatar_url: getStaticAvatarUrl(speakerData[0].image_url),
role: 'speaker',
}"
/>
Expand Down
8 changes: 5 additions & 3 deletions apps/web/app/pages/sponsors/[id]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { Job, Speaker, Sponsor } from '@vuejs-jp/model'
import { useLocaleCurrent } from '~/composables/useLocaleCurrent'
import { useSupabase } from '~/composables/useSupabase'
import { useSponsor } from '~/composables/useSponsor'
import { useSupabaseStorage } from '~/composables/useSupabaseStorage'
import { conferenceTitle, linkUrl, ogSponsorDescription } from '~/utils/constants'
import { generalOg, twitterOg } from '~/utils/og.constants'
import { useColor } from '@vuejs-jp/composable'
Expand Down Expand Up @@ -48,6 +49,7 @@ const currentLocale = useLocaleCurrent().locale
const pathWithLocale = usePathWithLocale()
const { color: updateColor } = useColor()
const { color, borderColor, isMoreSilver } = useSponsor()
const { getStaticAvatarUrl } = useSupabaseStorage()

useHead({
titleTemplate: (titleChunk) => `${sponsorData[0].name} | ${conferenceTitle}`,
Expand Down Expand Up @@ -92,7 +94,7 @@ useHead({
:style="{ border: `1px solid ${updateColor(borderColor(sponsorData[0].tag))}` }"
>
<img
:src="`${sponsorData[0].image_url}`"
:src="getStaticAvatarUrl(sponsorData[0].image_url)"
:alt="sponsorData[0].name"
width="570"
height="322"
Expand Down Expand Up @@ -126,7 +128,7 @@ useHead({
<VFSpeaker
v-for="(speaker, index) in speakerData"
:key="index"
:image="speaker.image_url"
:image="getStaticAvatarUrl(speaker.image_url)"
:company="currentLocale === 'en' ? speaker.company_en : speaker.company_ja"
:division="currentLocale === 'en' ? speaker.position_en : speaker.position_ja"
:name="currentLocale === 'en' ? speaker.name_en : speaker.name_ja"
Expand Down Expand Up @@ -158,7 +160,7 @@ useHead({
{{ `${sponsorData[0].name}のジョブボード` }}
</h3>
<nuxt-link :to="jobData[0].link_url" target="_blank">
<img :src="jobData[0].image_url" :alt="jobData[0].image_alt" />
<img :src="getStaticAvatarUrl(jobData[0].image_url)" :alt="jobData[0].image_alt" />
</nuxt-link>
</div>

Expand Down
5 changes: 4 additions & 1 deletion apps/web/app/pages/sponsors/[id]/share.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '#imports'
import { useLocaleCurrent } from '~/composables/useLocaleCurrent'
import { useSupabase } from '~/composables/useSupabase'
import { useSupabaseStorage } from '~/composables/useSupabaseStorage'
import { conferenceTitle, linkUrl, ogSponsorDescription } from '~/utils/constants'
import { generalOg, twitterOg } from '~/utils/og.constants'
import type { Sponsor } from '@vuejs-jp/model'
Expand All @@ -32,6 +33,8 @@ if (!sponsorData[0].detail_page_id) {

const currentLocale = useLocaleCurrent().locale

const { getStaticAvatarUrl } = useSupabaseStorage()

function copyUrl() {
const element = document.createElement('input')
element.value = `https://vuefes.jp/2024/namecard/${id}/share`
Expand Down Expand Up @@ -73,7 +76,7 @@ useHead({
class="session"
:user="{
display_name: sponsorData[0].name,
avatar_url: sponsorData[0].share_image_url,
avatar_url: getStaticAvatarUrl(sponsorData[0].share_image_url),
role: 'sponsor',
}"
/>
Expand Down
5 changes: 4 additions & 1 deletion apps/web/app/pages/staffs/[id]/share.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '#imports'
import { useLocaleCurrent } from '~/composables/useLocaleCurrent'
import { useSupabase } from '~/composables/useSupabase'
import { useSupabaseStorage } from '~/composables/useSupabaseStorage'
import { conferenceTitle, linkUrl, ogStaffDescription } from '~/utils/constants'
import { generalOg, twitterOg } from '~/utils/og.constants'
import type { Staff } from '@vuejs-jp/model'
Expand All @@ -28,6 +29,8 @@ if (!staffData) {

const currentLocale = useLocaleCurrent().locale

const { getStaticAvatarUrl } = useSupabaseStorage()

function copyUrl() {
const element = document.createElement('input')
element.value = `https://vuefes.jp/2024/staffs/${id}/share`
Expand Down Expand Up @@ -69,7 +72,7 @@ useHead({
class="staff"
:user="{
display_name: staffData[0].name,
avatar_url: staffData[0].image_url,
avatar_url: getStaticAvatarUrl(staffData[0].image_url),
role: 'staff',
}"
/>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions apps/web/app/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export const endedPurchaseStore = true

export const endedCreateNamecard = true

// Whether the conference is over
export const isDone = true

export const displayNameMaxLength = 24

export const photos = [
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/utils/environment.constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const isProd = process.env.NODE_ENV === 'production'

export const REDIRECT_URL = isProd ? 'https://vuefes.jp/2024' : 'https://localhost:3000'
export const REDIRECT_URL = 'https://vuefes.jp/2024'
1 change: 1 addition & 0 deletions apps/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": {
"lib": ["ESNext", "DOM"],
"types": [
"@types/node",
"@pinia/nuxt",
Expand Down