Skip to content

Commit

Permalink
퀘스트 공유하기 시 shortened URL이 있으면 활용하기 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeniuus authored Jul 6, 2024
1 parent b6bff4a commit 8765ce4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/(private)/quest/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export default function QuestList() {

function share(quests: QuestSummary[]) {
const [groupName] = quests[0].name.split(" - ")
const questList = quests.map((q) => `- ${q.name.split(" - ")[1]}: ${window.location.origin}/public/quest/${q.id}`)
const questList = quests.map((q) => {
const url = q.shortenedUrl || `${window.location.origin}/public/quest/${q.id}`
return `- ${q.name.split(" - ")[1]}: ${url}`
})

navigator.clipboard.writeText(`${groupName}\n${questList.join("\n")}`)
toast.success("공개 URL 목록이 클립보드에 복사되었습니다.")
Expand Down
1 change: 1 addition & 0 deletions lib/models/quest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { LatLng } from "./common"
export interface QuestSummary {
id: string
name: string
shortenedUrl?: string
}

export interface QuestDetail {
Expand Down

0 comments on commit 8765ce4

Please sign in to comment.