|
3 | 3 | <div class="contents" v-if="post"> |
4 | 4 | <div class="post-header"> |
5 | 5 | <div class="title-section" v-if="!isEditing"> |
6 | | - <h1 class="post-title">{{ post.title }}</h1> |
| 6 | + <div class="sub-title-section"> |
| 7 | + <h1 class="post-title"> |
| 8 | + {{ post.title }} |
| 9 | + </h1> |
| 10 | + <div class="post-actions-always-visible"> |
| 11 | + <button class="community-back-btn" @click="goback"> |
| 12 | + {{ $t("m.Community_List") }} |
| 13 | + </button> |
| 14 | + </div> |
| 15 | + </div> |
7 | 16 | <div class="badges-container"> |
8 | 17 | <span v-if="isNewPost" class="new-badge">NEW</span> |
9 | 18 | <span |
@@ -355,11 +364,22 @@ export default { |
355 | 364 | editedPostType: "", |
356 | 365 | editingCommentId: null, |
357 | 366 | editedCommentContent: "", |
| 367 | + prevRoute: null, |
358 | 368 | } |
359 | 369 | }, |
360 | 370 | created() { |
361 | 371 | this.fetchPostDetail() |
362 | 372 | }, |
| 373 | +
|
| 374 | + beforeRouteEnter(to, from, next) { |
| 375 | + next((vm) => { |
| 376 | + const validBoards = ["community", "community-free", "community-question"] |
| 377 | + if (from.name && validBoards.includes(from.name)) { |
| 378 | + sessionStorage.setItem("last_community_board", from.name) |
| 379 | + } |
| 380 | + }) |
| 381 | + }, |
| 382 | +
|
363 | 383 | methods: { |
364 | 384 | fetchPostDetail() { |
365 | 385 | this.isLoading = true |
@@ -428,6 +448,19 @@ export default { |
428 | 448 | this.$error("Failed to submit reply.") |
429 | 449 | }) |
430 | 450 | }, |
| 451 | + goback() { |
| 452 | + const lastBoard = sessionStorage.getItem("last_community_board") |
| 453 | +
|
| 454 | + if (lastBoard) { |
| 455 | + this.$router.push({ name: lastBoard }) |
| 456 | + } else { |
| 457 | + if (this.post.post_type === "QUESTION") { |
| 458 | + this.$router.push({ name: "community-question" }) |
| 459 | + } else { |
| 460 | + this.$router.push({ name: "community" }) |
| 461 | + } |
| 462 | + } |
| 463 | + }, |
431 | 464 | enterEditMode() { |
432 | 465 | this.isEditing = true |
433 | 466 | this.editedTitle = this.post.title |
@@ -667,6 +700,11 @@ main { |
667 | 700 | margin-bottom: 28px; |
668 | 701 | } |
669 | 702 |
|
| 703 | +.sub-title-section { |
| 704 | + display: flex; |
| 705 | + justify-content: space-between; |
| 706 | +} |
| 707 | +
|
670 | 708 | .post-title { |
671 | 709 | font-size: 28px; |
672 | 710 | font-weight: 600; |
@@ -786,7 +824,8 @@ main { |
786 | 824 | .post-delete-btn, |
787 | 825 | .post-save-btn, |
788 | 826 | .post-cancel-btn, |
789 | | -.question-status-toggle-btn { |
| 827 | +.question-status-toggle-btn, |
| 828 | +.community-back-btn { |
790 | 829 | padding: 8px 16px; |
791 | 830 | border: none; |
792 | 831 | border-radius: 8px; |
@@ -833,6 +872,18 @@ main { |
833 | 872 | box-shadow: 0 4px 8px rgba(231, 76, 60, 0.2); |
834 | 873 | } |
835 | 874 |
|
| 875 | +.community-back-btn { |
| 876 | + background: rgb(241, 243, 244); |
| 877 | + color: black; |
| 878 | +} |
| 879 | +
|
| 880 | +.community-back-btn:hover { |
| 881 | + background: lightgrey; |
| 882 | + color: rgb(50, 50, 50); |
| 883 | + transform: translateY(-1px); |
| 884 | + box-shadow: 0 4px 8px rgba(93, 93, 93, 0.2); |
| 885 | +} |
| 886 | +
|
836 | 887 | .post-save-btn { |
837 | 888 | background: #3498db; |
838 | 889 | color: white; |
|
0 commit comments