- {recentNotices.map(notice => (
+ {recentNotices.reverse().map(notice => (
- {filteredItems.map(item => (
+ {filteredItems.reverse().map(item => (
diff --git a/src/pages/Room.tsx b/src/pages/Room.tsx
index e19004d..b313165 100644
--- a/src/pages/Room.tsx
+++ b/src/pages/Room.tsx
@@ -68,7 +68,7 @@ const Room = () => {
mainChar: mainChar.character_name,
subChar: member.name
})
- openModal('alert')
+ openModal('alert') // 이거 나중에 삭제해야함
} catch {
setAlertMessage({
mainChar: member.name,
@@ -144,7 +144,7 @@ const Room = () => {
setSearchCharacter={handleSearchCharacter}
onDeleteGuild={
selectMember?.guildId
- ? () => deleteGuild(selectMember.guildId)
+ ? () => deleteGuild(selectMember.guildId as number)
: undefined
}
/>
diff --git a/src/pages/SearchCharacter.tsx b/src/pages/SearchCharacter.tsx
index a578277..9ca9202 100644
--- a/src/pages/SearchCharacter.tsx
+++ b/src/pages/SearchCharacter.tsx
@@ -1,39 +1,5 @@
-import { searchCharacterOcid } from '../apis/character/characterController'
import { CharacterPage } from '../components/character/CharacterPage'
-import { useState } from 'react'
-import { useUserStore } from '../store/userStore'
export const SearchCharacter = () => {
- const [characterName, setCharacterName] = useState('')
- const { setUserInfo } = useUserStore()
-
- const searchCharacterHandler = async () => {
- if (characterName.trim() === '') {
- alert('캐릭터 이름을 입력해주세요.')
- return
- }
-
- const { ocid } = await searchCharacterOcid(characterName.trim())
-
- if (!ocid) {
- alert('캐릭터를 찾을 수 없습니다.')
- return
- }
-
- setUserInfo({
- id: 0,
- firebaseId: '1',
- name: characterName.trim(),
- email: 'play3step@gmail.com',
- ocid: ocid
- })
- }
- return (
-
- )
+ return
}
diff --git a/src/pages/SearchGuild.tsx b/src/pages/SearchGuild.tsx
new file mode 100644
index 0000000..c470255
--- /dev/null
+++ b/src/pages/SearchGuild.tsx
@@ -0,0 +1,234 @@
+import { FiUsers } from 'react-icons/fi'
+import Button from '../components/common/Button'
+import { useSearchGuild } from '../hooks/search/useSearchGuild'
+
+import { servers } from '../data/worlds'
+import { MemberContainer } from '../components/guild/MemberContainer'
+import { Empty } from '../components/common/Empty'
+import { ActionBtnList } from '../components/guild/ActionBtnList'
+import { Guild, Member } from '../types/guild'
+import { useState } from 'react'
+import { useModalStore } from '../store/modalStore'
+import { DetailMemberModal } from '../components/modal/guild/DetailMemberModal'
+
+export const SearchGuild = () => {
+ const {
+ guildsInfo,
+ selectedServer,
+ setSelectedServer,
+ guildName,
+ setGuildName,
+ handleGuildKeyPress,
+ addGuildList,
+ removeGuildList,
+ guildList,
+ searchGuildHandler,
+ isLoading,
+ selectedGuildMember,
+ mainCharacterInfoSearchHandler,
+ isUpdating,
+ resetSearchParams
+ } = useSearchGuild()
+
+ const [searchCharacter, setSearchCharacter] = useState('')
+ const { activeModal, openModal } = useModalStore()
+
+ const [selectedMember, setSelectedMember] = useState<{
+ type: string
+ member: Member | null
+ }>({
+ type: '',
+ member: null
+ })
+ const handleSearchCharacter = (value: string) => {
+ setSearchCharacter(value)
+ }
+
+ const handleMemberSelect = async (type: string, member: Member) => {
+ setSelectedMember({ type: type, member: member })
+ if (type !== '미지정') {
+ openModal('detailMember')
+ }
+ }
+
+ return (
+
+ {guildsInfo?.length === 0 ? (
+
+
+
+
+
+
+ setGuildName(e.target.value)}
+ onKeyPress={handleGuildKeyPress}
+ className="flex-1 px-4 py-2.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 bg-white"
+ />
+
+
+
+
+
검색할 길드 목록
+
+ {guildList.map(guild => (
+
+
{guild}
+
+
+ ))}
+
+
+
+
+
+
+
+ ) : (
+
+
+
+
+
+
+
({
+ worldName: v.worldName,
+ guildName: v.guildName
+ })) as Guild[]) || []
+ }
+ mainCharacterInfoSearchHandler={
+ mainCharacterInfoSearchHandler
+ }
+ isUpdating={isUpdating}
+ />
+
+
+
+
+ {(isLoading || isUpdating) && (
+
+
+
+ 캐릭터 정보를 불러오는 중...
+
+
+ )}
+ {guildsInfo &&
+ guildsInfo.length > 0 &&
+ !isLoading &&
+ !isUpdating && (
+
({
+ guildName: v.guildName,
+ guildMasterName: v.guildMasterName,
+ memberDetailResponse: v.guildMember
+ }))}
+ masterName={selectedGuildMember?.guildMasterName}
+ guildName={selectedGuildMember?.guildName}
+ onSelect={handleMemberSelect}
+ searchCharacter={searchCharacter}
+ setSearchCharacter={handleSearchCharacter}
+ />
+ )}
+ {guildsInfo && guildsInfo.length === 0 && (
+
+ )}
+
+
+
+
+ )}
+ {activeModal === 'detailMember' &&
+ selectedMember &&
+ selectedMember.member &&
+ guildsInfo && (
+
({
+ guildName: v.guildName,
+ guildMasterName: v.guildMasterName,
+ memberDetailResponse: v.guildMember
+ }))}
+ />
+ )}
+
+ )
+}
diff --git a/src/pages/Signup.tsx b/src/pages/Signup.tsx
index 20ab52c..00900ff 100644
--- a/src/pages/Signup.tsx
+++ b/src/pages/Signup.tsx
@@ -15,7 +15,7 @@ const Signup = () => {
const { userLogout } = useAuth()
const { uid } = useAuthStore()
- const { updateUserInfo } = useUserStore()
+ const { updateUserInfo, setCharacterOcid } = useUserStore()
const onSubmit = async (e: React.FormEvent
) => {
e.preventDefault()
@@ -41,6 +41,7 @@ const Signup = () => {
nexonApiKey: result.generatedApiKey,
ocid: result.characterUid
})
+ setCharacterOcid(result.characterUid)
alert('API 키 등록이 완료되었습니다.')
diff --git a/src/store/authStore.ts b/src/store/authStore.ts
index bd1c450..149e9c0 100644
--- a/src/store/authStore.ts
+++ b/src/store/authStore.ts
@@ -15,11 +15,11 @@ export const useAuthStore = create(set => ({
token: null,
uid: null,
isLoggedIn: false,
- userType: 'guest',
+ userType: 'search',
storeLogin: (token: string, uid: string, userType: UserType) => {
set({ token, uid, isLoggedIn: true, userType })
},
storeLogout: () => {
- set({ token: null, uid: null, isLoggedIn: false, userType: 'guest' })
+ set({ token: null, uid: null, isLoggedIn: false, userType: 'search' })
}
}))
diff --git a/src/store/userStore.ts b/src/store/userStore.ts
index 4d490c7..cb0f681 100644
--- a/src/store/userStore.ts
+++ b/src/store/userStore.ts
@@ -1,27 +1,36 @@
import { create } from 'zustand'
import { User } from '../types/auth'
+import { guest } from '../data/guest'
interface UserState {
userInfo: User | null
userName: string | null
+ characterOcid: string
setUserInfo: (info: User) => void
setUserName: (name: string) => void
-
+ setCharacterOcid: (ocid: string) => void
updateUserInfo: (info: Partial) => void
clearUserInfo: () => void
}
export const useUserStore = create(set => ({
- userInfo: null,
+ userInfo: {
+ id: 0,
+ firebaseId: '1',
+ name: 'search',
+ email: 'play3step@gmail.com',
+ ocid: guest.ocid
+ },
userName: null,
-
+ characterOcid: guest.ocid,
setUserInfo: info => set({ userInfo: info }),
setUserName: name => set({ userName: name }),
-
+ setCharacterOcid: ocid => set({ characterOcid: ocid }),
updateUserInfo: info =>
set(state => ({
userInfo: state.userInfo ? { ...state.userInfo, ...info } : null
})),
- clearUserInfo: () => set({ userInfo: null, userName: null })
+ clearUserInfo: () =>
+ set({ userInfo: null, userName: null, characterOcid: guest.ocid })
}))
diff --git a/src/types/guild.ts b/src/types/guild.ts
index ca71e13..fc11312 100644
--- a/src/types/guild.ts
+++ b/src/types/guild.ts
@@ -33,7 +33,7 @@ export interface SearchGuild {
}
export interface NexonMembers {
- guildId: number
+ guildId?: number
guildName: string
guildMasterName?: string
memberDetailResponse?: Member[]
@@ -46,7 +46,7 @@ export interface RecordedMembers {
}
export interface Member {
- id: number
+ id?: number
imagePath: string
job: string
level: string
@@ -59,7 +59,6 @@ export interface Member {
level: string
job: string
imagePath: string
- description: string
}
}
@@ -74,3 +73,22 @@ export interface DetectResult {
toAdd: string[]
toRemove: string[]
}
+
+export interface SearchGuildResponse {
+ worldName: string
+ guildName: string
+ guildMasterName: string
+ guildMember: Member[]
+}
+
+export interface SearchGuildMemberResponse {
+ memberName: string
+ type: string
+ mainCharacterInfo: {
+ name: string
+ level: string
+ job: string
+ imagePath: string
+ gender: string
+ }
+}