Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
study2895 committed Dec 2, 2024
2 parents a294d77 + f39d097 commit ef0c314
Show file tree
Hide file tree
Showing 17 changed files with 1,051 additions and 225 deletions.
392 changes: 373 additions & 19 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"express": "^4.21.1",
"http-proxy-middleware": "^3.0.3",
"register-service-worker": "^1.7.2",
"styled-components": "^6.1.13",
"v-calendar": "^3.1.2",
"vue": "^3.2.13",
"vue-cal": "^4.10.0",
Expand Down
12 changes: 12 additions & 0 deletions src/assets/images/plusBtn.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/images/plusBtn2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 93 additions & 8 deletions src/components/common/feed/CommentInput.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,116 @@
<template>
<div class="comment-input">
<select v-model="selectedEmoji">
<option value="" disabled selected hidden><img src="../../../assets/images/smile.svg"></option>
<option value="" disabled selected hidden>#๏ธโƒฃ</option>
<option value="๐Ÿ˜Š">๐Ÿ˜Š</option>
<option value="๐Ÿ‘">๐Ÿ‘</option>
<option value="โค๏ธ">โค๏ธ</option>
<option value="๐Ÿ˜Ž">๐Ÿ˜Ž</option>
<option value="๐Ÿ˜">๐Ÿ˜</option>
</select>
<input type="text" v-model="comment" placeholder="๋Œ“๊ธ€ ์ž…๋ ฅ" />
<button @click="submitComment"><img src="../../../assets/images/add.svg"></button>
<input
class="realinput"
type="text"
v-model="comment"
placeholder="๋Œ“๊ธ€ ์ž…๋ ฅ"
/>
<button @click="submitComment">
<img src="../../../assets/images/add.svg" />
</button>
</div>
</template>

<script setup>
import { ref } from 'vue'
import { ref, onMounted } from 'vue'
const selectedEmoji = ref('')
const comment = ref('')
const goalId = '123'
const submitComment = () => {
/* ๋Œ“๊ธ€ ์ œ์ถœ */
const emojiMap = {
'๐Ÿ˜Š': 0,
'๐Ÿ‘': 1,
'โค๏ธ': 2,
'๐Ÿ˜Ž': 3,
'๐Ÿ˜': 4
}
const submitComment = async () => {
if (!comment.value.trim()) {
alert('๋Œ“๊ธ€์„ ์ž…๋ ฅํ•˜์„ธ์š”.')
return
}
try {
const emojiNumber = emojiMap[selectedEmoji.value] ?? -1
const payload = {
emoji: emojiNumber,
content: comment.value,
}
console.log("์š”์ฒญํ•  Payload:", payload)
const response = await fetch(
`${process.env.VUE_APP_BE_API_URL}/api/goals/${goalId}/comments`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
credentials: 'include',
body: JSON.stringify(payload),
}
)
if (response.ok) {
alert('๋Œ“๊ธ€์ด ์„ฑ๊ณต์ ์œผ๋กœ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค!')
selectedEmoji.value = ''
comment.value = ''
} else {
alert('๋Œ“๊ธ€ ์ถ”๊ฐ€ ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.')
}
} catch (error) {
console.error('๋Œ“๊ธ€ ์ „์†ก ์ค‘ ์˜ค๋ฅ˜:', error)
alert('๋Œ“๊ธ€ ์ถ”๊ฐ€ ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ์‹œ๋„ํ•ด์ฃผ์„ธ์š”.')
}
}
</script>
<style scoped>
.comment-input {
display: flex;
gap: 8px;
margin-top: 8px;
width: 98%;
}
.comment-input select:focus {
outline: none;
border: none;
box-shadow: none;
}
.realinput::placeholder {
color: #b3b3b3;
font-family: 'NaL';
font-size: 14px;
font-style: normal;
font-weight: 300;
line-height: normal;
}
.realinput {
outline: none;
border: none;
background-color: transparent;
border-radius: 0;
font-family: 'NaL';
font-size: 16px;
margin-left: 4px;
}
.realinput:focus {
outline: none;
border: none;
box-shadow: none;
}
</style>
40 changes: 34 additions & 6 deletions src/components/common/feed/CommentList.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<div class="comment-list">
<div v-for="comment in comments" :key="comment.id" class="comment">
<span>{{ comment.nickname }}</span>
<span>{{ comment.emoji }}</span>
<p>{{ comment.content }}</p>
<div class="nick">{{ comment.nickname }}</div>
<div>{{ comment.emoji }}</div>
<div class="comment">{{ comment.content }}</div>
</div>
</div>
</template>
Expand All @@ -18,10 +18,38 @@ const comments = ref([
</script>

<style scoped>
.comment-list .comment {
.comment-list{
display: flex;
flex-direction: column;
gap:5px;
margin-bottom: 5px;
}
.comment{
display: flex;
gap:10px;
margin-left: 5px;
}
.nick{
font-family: 'NaB';
font-size: 15px;
color:#FF7F00;
font-style: normal;
font-weight: 300;
line-height: normal;
display: flex;
align-items: center;
}
.comment{
font-family: 'NaL';
font-size: 14px;
color:#000000;
font-style: normal;
font-weight: 300;
line-height: normal;
display: flex;
gap: 8px;
align-items: center;
margin-bottom: 8px;
}
</style>
51 changes: 43 additions & 8 deletions src/components/common/feed/FollowStats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,67 @@
<span class="follower-count">{{ followerCount }}๋ช…</span>
<span class="following-text">ํŒ”๋กœ์ž‰</span>
<span class="following-count">{{ followingCount }}๋ช…</span>
<img src="../../../assets/images/next.svg">
<img class='na' src="../../../assets/images/next.svg" alt="Next" />
</div>
</div>
</template>

<script setup>
import { ref, computed } from 'vue'
import { ref, computed, onMounted } from 'vue'
import { useRouter } from 'vue-router'
const followerCount = ref(0) // API์—์„œ ๋ฐ›์•„์˜ค๋Š” ํŒ”๋กœ์›Œ ์ˆ˜
const followingCount = ref(0) // API์—์„œ ๋ฐ›์•„์˜ค๋Š” ํŒ”๋กœ์ž‰ ์ˆ˜
const followerCount = ref(0)
const followingCount = ref(0)
// ํ˜„์žฌ ๋‚ ์งœ๋ฅผ ํฌ๋งทํŒ…
const formattedDate = computed(() => {
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // ์›”์€ 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜๋ฏ€๋กœ +1
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year} . ${month} . ${day}`;
});
const API_URL = `${process.env.VUE_APP_BE_API_URL}/api`;
const fetchFollowCounts = async () => {
try {
const followerResponse = await fetch(`${API_URL}/followers`, {
method: 'GET',
credentials: 'include',
});
const followerData = await followerResponse.json();
followerCount.value = Array.isArray(followerData) ? followerData.length : 0;
const followingResponse = await fetch(`${API_URL}/following`, {
method: 'GET',
credentials: 'include',
});
const followingData = await followingResponse.json();
followingCount.value = Array.isArray(followingData) ? followingData.length : 0;
} catch (error) {
console.error('ํŒ”๋กœ์›Œ ๋ฐ ํŒ”๋กœ์ž‰ ์ˆ˜ ๊ฐ€์ ธ์˜ค๊ธฐ ์‹คํŒจ:', error);
followerCount.value = 0;
followingCount.value = 0;
}
};
const router = useRouter()
const goToFollowPage = () => {
// ํŒ”๋กœ์šฐ ๊ด€๋ฆฌ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•˜๋Š” ํ•จ์ˆ˜
router.push('/feed/ako-stamp-follow')
}
onMounted(() => {
fetchFollowCounts();
});
</script>

<style scoped>
.follow-stats {
display: flex;
align-items: center;
width: 100%;
height: 37px;
padding: 8px;
border-radius: 10px;
Expand All @@ -45,7 +76,7 @@ const goToFollowPage = () => {
.date-info {
flex: 1;
text-align: left;
color: #FF7F00; /* ๋‚ ์งœ ์ƒ‰์ƒ */
color: #FF7F00;
font-family: 'NaR';
font-size: 0.9rem;
padding-left: 5px;
Expand Down Expand Up @@ -84,4 +115,8 @@ const goToFollowPage = () => {
font-weight: 400;
line-height: normal;
}
.na{
cursor: pointer;
}
</style>
3 changes: 2 additions & 1 deletion src/components/common/feed/FriendGoal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import CommentInput from './CommentInput.vue'
import CommentList from './CommentList.vue'
const friendNickname = ref('ํ† ๋‹ˆ')
const friendGoalContent = ref('์ด๋”ฐ ์ƒ๋ก์›์—์„œ ๋ฐฅ๋จน์„์‚ฌ๋žŒ? ๊น€์น˜์ฒ ํŒ์–ด์ฉŒ๊ณ ์ €์ฉŒ๊ณ ')
const friendGoalContent = ref('์ด๋”ฐ ์ƒ๋ก์›์—์„œ ๋ฐฅ๋จน์„์‚ฌ๋žŒ์žˆ๋‚˜์š”? ๊ฐ™์ด ๋จน์–ด์š”')
const showCommentSection = ref(false)
const toggleCommentSection = () => {
Expand Down Expand Up @@ -72,5 +72,6 @@ const toggleCommentSection = () => {
.btn button:hover {
background: none;
outline: none;
}
</style>
Loading

0 comments on commit ef0c314

Please sign in to comment.