Skip to content

Commit

Permalink
Merge pull request #190 from vuejs-jp/enhance/detail-page-id
Browse files Browse the repository at this point in the history
[スピーカー、スポンサー] add column for detail_page_id
  • Loading branch information
jiyuujin authored Jul 12, 2024
2 parents 0f2c4da + aad5811 commit c886bed
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 6 deletions.
11 changes: 11 additions & 0 deletions apps/web/app/components/admin/SpeakerItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const newSpeaker = ref<FormSpeaker>({
...props.speaker?.id && { id: props.speaker?.id },
name_ja: props.speaker?.name_ja ?? '',
name_en: props.speaker?.name_en ?? '',
detail_page_id: props.speaker?.detail_page_id ?? '',
image_url: props.speaker?.image_url ?? '',
caption_ja: props.speaker?.caption_ja ?? '',
caption_en: props.speaker?.caption_en ?? '',
Expand Down Expand Up @@ -47,6 +48,9 @@ const updateNameJa = (e: any) => {
const updateNameEn = (e: any) => {
newSpeaker.value.name_en = e.target.value
}
const updateDetailPageId = (e: any) => {
newSpeaker.value.detail_page_id = e.target.value
}
const checkFiles = async (files: File[]) => {
if (files.length === 0) return
Expand Down Expand Up @@ -105,6 +109,13 @@ const onSubmit = () => {
label="名前 [EN]"
@input="updateNameEn"
/>
<VFInputField
id="detail_page_id"
v-model="newSpeaker.detail_page_id"
name="detail_page_id"
label="詳細ページのパス"
@input="updateDetailPageId"
/>
<VFDragDropArea file-name="profiledata" file-accept="image/*" @check-files="checkFiles">
<div class="upload">
<img
Expand Down
2 changes: 2 additions & 0 deletions apps/web/app/components/admin/SpeakerList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const handleDialog = (id?: string) => {
<table id="speakers">
<tr>
<th>name</th>
<th>detail_page_id</th>
<th>image_url</th>
<th>caption</th>
<th>description</th>
Expand All @@ -36,6 +37,7 @@ const handleDialog = (id?: string) => {
<p>{{ speaker.name_ja }}</p>
<p>{{ speaker.name_en }}</p>
</td>
<td>{{ speaker.detail_page_id }}</td>
<td>
<img
v-if="speaker.image_url"
Expand Down
11 changes: 11 additions & 0 deletions apps/web/app/components/admin/SponsorItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const { getFullAvatarUrl } = useSupabaseStorage()
const newSponsor = ref({
...props.sponsor?.id && { id: props.sponsor?.id },
name: props.sponsor?.name ?? '',
detail_page_id: props.sponsor?.detail_page_id ?? '',
image_url: props.sponsor?.image_url ?? '',
description_ja: props.sponsor?.description_ja ?? '',
description_en: props.sponsor?.description_en ?? '',
Expand All @@ -32,6 +33,9 @@ const tagText = ref(props.sponsor?.tag?.map((t) => t).join(',') ?? '')
const updateName = (e: any) => {
newSponsor.value.name = e.target.value
}
const updateDetailPageId = (e: any) => {
newSponsor.value.detail_page_id = e.target.value
}
const checkFiles = async (files: File[]) => {
if (files.length === 0) return
Expand Down Expand Up @@ -79,6 +83,13 @@ const onSubmit = () => {
label="Name"
@input="updateName"
/>
<VFInputField
id="detail_page_id"
v-model="newSponsor.detail_page_id"
name="detail_page_id"
label="詳細ページのパス"
@input="updateDetailPageId"
/>
<VFDragDropArea file-name="profiledata" file-accept="image/*" @check-files="checkFiles">
<div class="upload">
<img
Expand Down
2 changes: 2 additions & 0 deletions apps/web/app/components/admin/SponsorList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const handleDialog = (id?: string) => {
<table id="sponsors">
<tr>
<th>name</th>
<th>detail_page_id</th>
<th>image_url</th>
<th>description</th>
<th>link_url</th>
Expand All @@ -33,6 +34,7 @@ const handleDialog = (id?: string) => {
</tr>
<tr v-for="sponsor in sponsors" :key="sponsor.id">
<td>{{ sponsor.name }}</td>
<td>{{ sponsor.detail_page_id }}</td>
<td>
<img
v-if="sponsor.image_url"
Expand Down
32 changes: 26 additions & 6 deletions apps/web/app/types/generated/supabase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
export type Json = string | number | boolean | null | { [key: string]: Json | undefined } | Json[]
export type Json =
| string
| number
| boolean
| null
| { [key: string]: Json | undefined }
| Json[]

export type Database = {
graphql_public: {
Expand Down Expand Up @@ -111,6 +117,7 @@ export type Database = {
created_at: string
description_en: string
description_ja: string
detail_page_id: string | null
display_order: number | null
github_id: string | null
id: string
Expand Down Expand Up @@ -140,6 +147,7 @@ export type Database = {
created_at?: string
description_en: string
description_ja: string
detail_page_id?: string | null
display_order?: number | null
github_id?: string | null
id?: string
Expand Down Expand Up @@ -169,6 +177,7 @@ export type Database = {
created_at?: string
description_en?: string
description_ja?: string
detail_page_id?: string | null
display_order?: number | null
github_id?: string | null
id?: string
Expand Down Expand Up @@ -199,6 +208,7 @@ export type Database = {
created_at: string
description_en: string
description_ja: string
detail_page_id: string | null
display_order: number | null
id: string
image_url: string | null
Expand All @@ -213,6 +223,7 @@ export type Database = {
created_at?: string
description_en: string
description_ja: string
detail_page_id?: string | null
display_order?: number | null
id?: string
image_url?: string | null
Expand All @@ -227,6 +238,7 @@ export type Database = {
created_at?: string
description_en?: string
description_ja?: string
detail_page_id?: string | null
display_order?: number | null
id?: string
image_url?: string | null
Expand Down Expand Up @@ -617,16 +629,20 @@ export type Tables<
}
? R
: never
: PublicTableNameOrOptions extends keyof (PublicSchema['Tables'] & PublicSchema['Views'])
? (PublicSchema['Tables'] & PublicSchema['Views'])[PublicTableNameOrOptions] extends {
: PublicTableNameOrOptions extends keyof (PublicSchema['Tables'] &
PublicSchema['Views'])
? (PublicSchema['Tables'] &
PublicSchema['Views'])[PublicTableNameOrOptions] extends {
Row: infer R
}
? R
: never
: never

export type TablesInsert<
PublicTableNameOrOptions extends keyof PublicSchema['Tables'] | { schema: keyof Database },
PublicTableNameOrOptions extends
| keyof PublicSchema['Tables']
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicTableNameOrOptions['schema']]['Tables']
: never = never,
Expand All @@ -645,7 +661,9 @@ export type TablesInsert<
: never

export type TablesUpdate<
PublicTableNameOrOptions extends keyof PublicSchema['Tables'] | { schema: keyof Database },
PublicTableNameOrOptions extends
| keyof PublicSchema['Tables']
| { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicTableNameOrOptions['schema']]['Tables']
: never = never,
Expand All @@ -664,7 +682,9 @@ export type TablesUpdate<
: never

export type Enums<
PublicEnumNameOrOptions extends keyof PublicSchema['Enums'] | { schema: keyof Database },
PublicEnumNameOrOptions extends
| keyof PublicSchema['Enums']
| { schema: keyof Database },
EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
? keyof Database[PublicEnumNameOrOptions['schema']]['Enums']
: never = never,
Expand Down
1 change: 1 addition & 0 deletions packages/model/lib/speaker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type Speaker = {
id?: string
name_ja: string
name_en: string
detail_page_id?: string
image_url?: string
caption_ja?: string
caption_en?: string
Expand Down
1 change: 1 addition & 0 deletions packages/model/lib/sponsor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Tag = 'name-card'
export type Sponsor = {
id: string
name: string
detail_page_id?: string
description_ja: string
description_en: string
speaker_id?: string
Expand Down
4 changes: 4 additions & 0 deletions supabase/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ create table if not exists public.sponsors (

ALTER TABLE public.sponsors ADD COLUMN display_order int;

ALTER TABLE public.sponsors ADD COLUMN detail_page_id varchar(40);

alter table
public.sponsors enable row level security;

Expand Down Expand Up @@ -77,6 +79,8 @@ create table if not exists public.speakers (

ALTER TABLE public.speakers ADD COLUMN display_order int;

ALTER TABLE public.speakers ADD COLUMN detail_page_id varchar(40);

alter table
public.speakers enable row level security;

Expand Down

0 comments on commit c886bed

Please sign in to comment.