Skip to content

Commit b50cc20

Browse files
committed
#733 문제 풀이 커뮤니티 활성화 개선
- 질문하기 탭 브랜드 강조색 적용해 시인성 개선 - 오답 제출 시 질문 유도 넛지 배너 추가 (클릭 시 질문 탭 이동) - 질문 작성 모달 제목 기본값을 "[문제번호] 문제제목"으로 채움
1 parent ab0e0ac commit b50cc20

2 files changed

Lines changed: 84 additions & 3 deletions

File tree

‎frontend/src/pages/oj/views/problem/problemSolving/Problem.vue‎

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,29 @@
3434
제출 현황
3535
</div>
3636
<div
37-
class="tab-header"
37+
class="tab-header tab-header--ask"
3838
:class="{ active: leftPainActiveTab === 'community' }"
3939
@click="leftPainActiveTab = 'community'"
4040
>
4141
<i class="fi fi-rr-map-marker-question"></i>
4242
질문하기
4343
</div>
4444
</div>
45+
<div v-if="showAskNudge" class="ask-nudge">
46+
<span class="ask-nudge-text">
47+
이 문제에서 막혔나요? 다른 사람에게 질문해보세요.
48+
</span>
49+
<div class="ask-nudge-actions">
50+
<button class="ask-nudge-go" @click="goAsk">질문하기 →</button>
51+
<button
52+
class="ask-nudge-close"
53+
aria-label="닫기"
54+
@click="showAskNudge = false"
55+
>
56+
✕
57+
</button>
58+
</div>
59+
</div>
4560
<div class="tab-content">
4661
<ProblemDetailFlexibleContainer
4762
v-show="leftPainActiveTab === 'problem'"
@@ -206,6 +221,7 @@ export default {
206221
},
207222
modalCheck: false,
208223
leftPainActiveTab: "problem",
224+
showAskNudge: false,
209225
rightPainActiveTab: "editor",
210226
lastSubmissionId: null,
211227
isInitialized: false,
@@ -280,6 +296,7 @@ export default {
280296
this.result = { result: 9 }
281297
this.lastSubmissionId = null
282298
this.leftPainActiveTab = "problem"
299+
this.showAskNudge = false
283300
this.modalCheck = false
284301
this.problem = this.getEmptyProblem()
285302
},
@@ -466,6 +483,10 @@ export default {
466483
check() {
467484
alert(this.code)
468485
},
486+
goAsk() {
487+
this.leftPainActiveTab = "community"
488+
this.showAskNudge = false
489+
},
469490
checkSubmissionStatus() {
470491
// 使用setTimeout避免一些问题
471492
if (this.refreshStatus) {
@@ -483,6 +504,8 @@ export default {
483504
484505
this.leftPainActiveTab = "submission"
485506
this.lastSubmissionId = id
507+
// 통과(Accepted=0)하지 못한 결과면 질문 유도 넛지 표시
508+
this.showAskNudge = this.result.result !== 0
486509
487510
clearTimeout(this.refreshStatus)
488511
this.init({
@@ -508,6 +531,7 @@ export default {
508531
}
509532
this.submissionId = ""
510533
this.result = { result: 9 }
534+
this.showAskNudge = false
511535
this.submitting = true
512536
let data = {
513537
problem_id: this.problem.id,
@@ -807,6 +831,63 @@ export default {
807831
background-color: var(--bg-color);
808832
}
809833
834+
/* 질문하기 탭: 무채색 탭들 사이에서 눈에 띄도록 브랜드 강조색 부여 */
835+
.tab-header--ask {
836+
color: #5b64ed;
837+
font-weight: 700;
838+
}
839+
840+
.tab-header--ask:not(.active) {
841+
background-color: rgba(91, 100, 237, 0.07);
842+
}
843+
844+
/* 오답 후 질문 유도 넛지 */
845+
.ask-nudge {
846+
display: flex;
847+
align-items: center;
848+
justify-content: space-between;
849+
gap: 12px;
850+
margin: 8px 0;
851+
padding: 9px 12px;
852+
border: 1px solid rgba(91, 100, 237, 0.35);
853+
background-color: rgba(91, 100, 237, 0.08);
854+
border-radius: 8px;
855+
font-size: 13px;
856+
color: inherit;
857+
}
858+
859+
.ask-nudge-actions {
860+
display: flex;
861+
align-items: center;
862+
gap: 8px;
863+
flex-shrink: 0;
864+
}
865+
866+
.ask-nudge-go {
867+
border: none;
868+
background-color: #5b64ed;
869+
color: #fff;
870+
font-weight: 700;
871+
font-size: 13px;
872+
padding: 6px 12px;
873+
border-radius: 6px;
874+
cursor: pointer;
875+
white-space: nowrap;
876+
}
877+
878+
.ask-nudge-go:hover {
879+
filter: brightness(1.05);
880+
}
881+
882+
.ask-nudge-close {
883+
border: none;
884+
background: transparent;
885+
color: #9999a6;
886+
font-size: 14px;
887+
line-height: 1;
888+
cursor: pointer;
889+
}
890+
810891
.tab-content {
811892
height: calc(100% - 40px);
812893
min-height: 0;

‎frontend/src/pages/oj/views/problem/problemSolving/problemSolvingComponent/ProblemCommunity.vue‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,9 @@ export default {
376376
this.query.page = 1
377377
this.fetchPosts()
378378
},
379-
// 문제 질문 작성 시, 문제 태그 prefix 추가
379+
// 문제 질문 작성 시, "[문제 번호] 문제 제목" 형태로 제목 기본 채움
380380
openCreateModal() {
381-
this.newPost.title = `[${this.problem._id}] `
381+
this.newPost.title = `[${this.problem._id}] ${this.problem.title || ""}`
382382
this.showCreateModal = true
383383
},
384384
},

0 commit comments

Comments
 (0)