diff --git a/src/assets/images/members/others/itoumarika_2020-09-26.jpg b/src/assets/images/members/others/itoumarika_2020-09-26.jpg new file mode 100644 index 00000000000..9d8b95b2527 Binary files /dev/null and b/src/assets/images/members/others/itoumarika_2020-09-26.jpg differ diff --git a/src/assets/images/members/others/noujouami_2020-09-26.jpg b/src/assets/images/members/others/noujouami_2020-09-26.jpg new file mode 100644 index 00000000000..75650364959 Binary files /dev/null and b/src/assets/images/members/others/noujouami_2020-09-26.jpg differ diff --git a/src/assets/images/members/others/sagaraiori_2020-09-26.jpg b/src/assets/images/members/others/sagaraiori_2020-09-26.jpg new file mode 100644 index 00000000000..394c9a3dbfd Binary files /dev/null and b/src/assets/images/members/others/sagaraiori_2020-09-26.jpg differ diff --git a/src/assets/images/members/others/saitouyuuri_2020-09-26.jpg b/src/assets/images/members/others/saitouyuuri_2020-09-26.jpg new file mode 100644 index 00000000000..681af2bd816 Binary files /dev/null and b/src/assets/images/members/others/saitouyuuri_2020-09-26.jpg differ diff --git a/src/data/members.json b/src/data/members.json index 6052b050dab..9f5e610e3db 100644 --- a/src/data/members.json +++ b/src/data/members.json @@ -514,14 +514,14 @@ "bloodType": "a", "origin": "Düsseldorf, Germany", "sites": [ - { - "title": "blog", - "url": "https://blog.nogizaka46.com/erika.ikuta/" - }, { "title": "Instagram", "url": "https://www.instagram.com/ikutaerika.official/" }, + { + "title": "blog", + "url": "https://blog.nogizaka46.com/erika.ikuta/" + }, { "title": "Profile", "url": "https://www.nogizaka46.com/member/detail/ikutaerika.php" @@ -1524,14 +1524,14 @@ "bloodType": "ab", "origin": "大分県", "sites": [ - { - "title": "Official", - "url": "https://etomisa.jp/" - }, { "title": "Instagram", "url": "https://www.instagram.com/misa_eto_official/" }, + { + "title": "Official", + "url": "https://etomisa.jp/" + }, { "title": "Profile", "url": "https://n46llc.com/s/m00/artist/10" @@ -2391,7 +2391,8 @@ "members/singles/17/saitouyuuri.jpg", "members/singles/20/saitouyuuri.jpg", "members/singles/22/saitouyuuri.jpg", - "members/others/saitouyuuri_2020-04-29.jpg" + "members/others/saitouyuuri_2020-04-29.jpg", + "members/others/saitouyuuri_2020-09-26.jpg" ], "singles": [ { @@ -3205,6 +3206,10 @@ "bloodType": "a", "origin": "群馬県", "sites": [ + { + "title": "YouTube", + "url": "https://www.youtube.com/c/maishiraishi" + }, { "title": "blog", "url": "https://blog.nogizaka46.com/mai.shiraishi/" @@ -3213,10 +3218,6 @@ "title": "Profile", "url": "https://www.nogizaka46.com/member/detail/shiraishimai.php" }, - { - "title": "YouTube", - "url": "https://www.youtube.com/c/maishiraishi" - }, { "title": "755", "url": "https://7gogo.jp/shiraishi-mai" @@ -3577,14 +3578,14 @@ "bloodType": "a", "origin": "千葉県", "sites": [ - { - "title": "blog", - "url": "https://blog.nogizaka46.com/kazumi.takayama/" - }, { "title": "Instagram", "url": "https://instagram.com/takayama.kazumi.official/" }, + { + "title": "blog", + "url": "https://blog.nogizaka46.com/kazumi.takayama/" + }, { "title": "Profile", "url": "https://www.nogizaka46.com/member/detail/takayamakazumi.php" @@ -4253,14 +4254,14 @@ "bloodType": "o", "origin": "大阪府", "sites": [ - { - "title": "Official", - "url": "https://nishinonanase.com/" - }, { "title": "Instagram", "url": "https://www.instagram.com/nishino.nanase.official/" }, + { + "title": "Official", + "url": "https://nishinonanase.com/" + }, { "title": "Profile", "url": "https://n46llc.com/s/m00/artist/7" @@ -4465,7 +4466,8 @@ "members/singles/17/noujouami.jpg", "members/singles/20/noujouami.jpg", "members/singles/22/noujouami.jpg", - "members/others/noujouami_2020-04-29.jpg" + "members/others/noujouami_2020-04-29.jpg", + "members/others/noujouami_2020-09-26.jpg" ], "singles": [ { @@ -5545,14 +5547,14 @@ "bloodType": "b", "origin": "大阪府", "sites": [ - { - "title": "blog", - "url": "https://blog.nogizaka46.com/sayuri.matsumura/" - }, { "title": "Instagram", "url": "https://www.instagram.com/matsumura_sayuri_official/" }, + { + "title": "blog", + "url": "https://blog.nogizaka46.com/sayuri.matsumura/" + }, { "title": "Profile", "url": "https://www.nogizaka46.com/member/detail/matsumurasayuri.php" @@ -7303,7 +7305,8 @@ "members/singles/14/itoumarika.jpg", "members/singles/15/itoumarika.jpg", "members/singles/17/itoumarika.jpg", - "members/others/itoumarika_2020-04-29.jpg" + "members/others/itoumarika_2020-04-29.jpg", + "members/others/itoumarika_2020-09-26.jpg" ], "singles": [ { @@ -7446,14 +7449,14 @@ "bloodType": "o", "origin": "神奈川県", "sites": [ - { - "title": "Official", - "url": "https://itomarika.com/" - }, { "title": "Instagram", "url": "https://www.instagram.com/marikaito_official/" }, + { + "title": "Official", + "url": "https://itomarika.com/" + }, { "title": "Profile", "url": "https://n46llc.com/s/m00/artist/3" @@ -8087,13 +8090,13 @@ "bloodType": "o", "origin": "静岡県", "sites": [ - { - "title": "Official", - "url": "https://fukagawamai.com/" - }, { "title": "Instagram", "url": "https://www.instagram.com/fukagawamai.official/" + }, + { + "title": "Official", + "url": "https://fukagawamai.com/" } ], "photoAlbums": [ @@ -10427,14 +10430,14 @@ "bloodType": "o", "origin": "千葉県", "sites": [ - { - "title": "Twitter", - "url": "https://twitter.com/seira_miyazawa/" - }, { "title": "Instagram", "url": "https://www.instagram.com/seira_miyazawa/" }, + { + "title": "Twitter", + "url": "https://twitter.com/seira_miyazawa/" + }, { "title": "Ameba", "url": "https://ameblo.jp/seira-miyazawa/" @@ -14536,7 +14539,8 @@ "members/singles/14/sagaraiori.jpg", "members/singles/15/sagaraiori.jpg", "members/singles/17/sagaraiori.jpg", - "members/others/sagaraiori_2020-04-29.jpg" + "members/others/sagaraiori_2020-04-29.jpg", + "members/others/sagaraiori_2020-09-26.jpg" ], "singles": [ { diff --git a/src/server/actors/Members/raw/creator.ts b/src/server/actors/Members/raw/creator.ts index 9256c1ba572..4380e654e52 100644 --- a/src/server/actors/Members/raw/creator.ts +++ b/src/server/actors/Members/raw/creator.ts @@ -1,4 +1,5 @@ import { MemberRaw } from 'server/actors/Members/models'; +import { sortBySocialMedia } from 'utils/arrays'; type CreateMemberRawParams = { name: MemberRaw['name']; @@ -27,7 +28,16 @@ type CreateMemberRawParams = { graduatedDate?: string; }; -export const createMemberRaw = (params: CreateMemberRawParams): MemberRaw => { +type CreateMemberOptions = { + autoSortSites?: boolean; +}; + +export const createMemberRaw = ( + params: CreateMemberRawParams, + options: CreateMemberOptions = { + autoSortSites: true, + } +): MemberRaw => { const graduation = params.graduatedDate !== undefined ? { @@ -58,7 +68,12 @@ export const createMemberRaw = (params: CreateMemberRawParams): MemberRaw => { height: params.height, bloodType: params.bloodType, origin: params.origin, - sites: params.sites ?? [], + sites: + params.sites === undefined + ? [] + : options.autoSortSites + ? sortBySocialMedia(params.sites, 'asc') + : params.sites, photoAlbums: params.photoAlbums?.map(photoAlbum => ({ title: photoAlbum.title, diff --git a/src/server/actors/Members/raw/editor/firstGen.ts b/src/server/actors/Members/raw/editor/firstGen.ts index af11bfaaa77..988f9c7972e 100644 --- a/src/server/actors/Members/raw/editor/firstGen.ts +++ b/src/server/actors/Members/raw/editor/firstGen.ts @@ -69,14 +69,14 @@ export const FIRST_GEN_MEMBERS: MemberRaw[] = [ bloodType: BloodType.A, origin: Birthplace.Düsseldorf, sites: [ - { - title: SocialMedia.Blog, - url: 'https://blog.nogizaka46.com/erika.ikuta/', - }, { title: SocialMedia.Instagram, url: 'https://www.instagram.com/ikutaerika.official/', }, + { + title: SocialMedia.Blog, + url: 'https://blog.nogizaka46.com/erika.ikuta/', + }, { title: SocialMedia.Profile, url: 'https://www.nogizaka46.com/member/detail/ikutaerika.php', @@ -212,14 +212,14 @@ export const FIRST_GEN_MEMBERS: MemberRaw[] = [ bloodType: BloodType.AB, origin: Birthplace.Oita, sites: [ - { - title: SocialMedia.Official, - url: 'https://etomisa.jp/', - }, { title: SocialMedia.Instagram, url: 'https://www.instagram.com/misa_eto_official/', }, + { + title: SocialMedia.Official, + url: 'https://etomisa.jp/', + }, { title: SocialMedia.Profile, url: 'https://n46llc.com/s/m00/artist/10', @@ -455,6 +455,10 @@ export const FIRST_GEN_MEMBERS: MemberRaw[] = [ bloodType: BloodType.A, origin: Birthplace.Gunma, sites: [ + { + title: SocialMedia.YouTube, + url: 'https://www.youtube.com/c/maishiraishi', + }, { title: SocialMedia.Blog, url: 'https://blog.nogizaka46.com/mai.shiraishi/', @@ -463,10 +467,6 @@ export const FIRST_GEN_MEMBERS: MemberRaw[] = [ title: SocialMedia.Profile, url: 'https://www.nogizaka46.com/member/detail/shiraishimai.php', }, - { - title: SocialMedia.YouTube, - url: 'https://www.youtube.com/c/maishiraishi', - }, { title: SocialMedia.Nanagogo, url: 'https://7gogo.jp/shiraishi-mai', @@ -536,14 +536,14 @@ export const FIRST_GEN_MEMBERS: MemberRaw[] = [ bloodType: BloodType.A, origin: Birthplace.Chiba, sites: [ - { - title: SocialMedia.Blog, - url: 'https://blog.nogizaka46.com/kazumi.takayama/', - }, { title: SocialMedia.Instagram, url: 'https://instagram.com/takayama.kazumi.official/', }, + { + title: SocialMedia.Blog, + url: 'https://blog.nogizaka46.com/kazumi.takayama/', + }, { title: SocialMedia.Profile, url: 'https://www.nogizaka46.com/member/detail/takayamakazumi.php', @@ -629,14 +629,14 @@ export const FIRST_GEN_MEMBERS: MemberRaw[] = [ bloodType: BloodType.O, origin: Birthplace.Osaka, sites: [ - { - title: SocialMedia.Official, - url: 'https://nishinonanase.com/', - }, { title: SocialMedia.Instagram, url: 'https://www.instagram.com/nishino.nanase.official/', }, + { + title: SocialMedia.Official, + url: 'https://nishinonanase.com/', + }, { title: SocialMedia.Profile, url: 'https://n46llc.com/s/m00/artist/7', @@ -788,14 +788,14 @@ export const FIRST_GEN_MEMBERS: MemberRaw[] = [ bloodType: BloodType.B, origin: Birthplace.Osaka, sites: [ - { - title: SocialMedia.Blog, - url: 'https://blog.nogizaka46.com/sayuri.matsumura/', - }, { title: SocialMedia.Instagram, url: 'https://www.instagram.com/matsumura_sayuri_official/', }, + { + title: SocialMedia.Blog, + url: 'https://blog.nogizaka46.com/sayuri.matsumura/', + }, { title: SocialMedia.Profile, url: 'https://www.nogizaka46.com/member/detail/matsumurasayuri.php', @@ -971,14 +971,14 @@ export const FIRST_GEN_MEMBERS: MemberRaw[] = [ bloodType: BloodType.O, origin: Birthplace.Kanagawa, sites: [ - { - title: SocialMedia.Official, - url: 'https://itomarika.com/', - }, { title: SocialMedia.Instagram, url: 'https://www.instagram.com/marikaito_official/', }, + { + title: SocialMedia.Official, + url: 'https://itomarika.com/', + }, { title: SocialMedia.Profile, url: 'https://n46llc.com/s/m00/artist/3', @@ -1055,14 +1055,14 @@ export const FIRST_GEN_MEMBERS: MemberRaw[] = [ bloodType: BloodType.O, origin: Birthplace.Shizuoka, sites: [ - { - title: SocialMedia.Official, - url: 'https://fukagawamai.com/', - }, { title: SocialMedia.Instagram, url: 'https://www.instagram.com/fukagawamai.official/', }, + { + title: SocialMedia.Official, + url: 'https://fukagawamai.com/', + }, ], photoAlbums: [ { @@ -1246,14 +1246,14 @@ export const FIRST_GEN_MEMBERS: MemberRaw[] = [ bloodType: BloodType.O, origin: Birthplace.Chiba, sites: [ - { - title: SocialMedia.Twitter, - url: 'https://twitter.com/seira_miyazawa/', - }, { title: SocialMedia.Instagram, url: 'https://www.instagram.com/seira_miyazawa/', }, + { + title: SocialMedia.Twitter, + url: 'https://twitter.com/seira_miyazawa/', + }, { title: 'Ameba', url: 'https://ameblo.jp/seira-miyazawa/', diff --git a/src/utils/arrays.ts b/src/utils/arrays.ts index 1f6752860fc..82b68d87f59 100644 --- a/src/utils/arrays.ts +++ b/src/utils/arrays.ts @@ -1,4 +1,8 @@ import { JoinedGenerationType } from 'server/actors/Members/constants/joinedGeneration'; +import { SocialMedia } from 'server/actors/Members/constants/socialMedia'; +import { Site } from 'server/types/commons'; + +type SortOrder = 'asc' | 'desc'; export const arrayToObject = ( array: T[], @@ -20,7 +24,7 @@ export const arrayToObject = ( export const sortByDate = ( array: T[], keyField: keyof T, - order: 'asc' | 'desc' + order: SortOrder ): T[] => { return array.slice().sort((itemA, itemB) => { return order === 'asc' @@ -37,7 +41,7 @@ export const sortByJoin = < } >( array: T[], - order: 'asc' | 'desc' + order: SortOrder ): T[] => { const joinWeightMap: Record = { exchange: 100, @@ -54,6 +58,33 @@ export const sortByJoin = < }); }; +export function sortBySocialMedia( + sites: readonly Site[], + order: SortOrder +): Site[] { + const socialMediaWeightMap: Record = { + [SocialMedia.Instagram]: 1, + [SocialMedia.Twitter]: 2, + [SocialMedia.YouTube]: 3, + [SocialMedia.Blog]: 4, + [SocialMedia.FourthGenBlog]: 5, + [SocialMedia.Official]: 6, + [SocialMedia.OnlineSalon]: 7, + [SocialMedia.Profile]: 8, + }; + + return sites.slice().sort((mediaA, mediaB) => { + const weightA = socialMediaWeightMap[mediaA.title]; + const weightB = socialMediaWeightMap[mediaB.title]; + + if (weightA !== undefined && weightB !== undefined) { + return order === 'asc' ? weightA - weightB : weightB - weightA; + } else { + return 1; + } + }); +} + export const filterDuplicate = < T extends string | number | bigint | boolean | symbol >(