index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <script setup lang="ts">
  2. import { useRoute } from "vue-router";
  3. import { onMounted, defineAsyncComponent } from "vue";
  4. import { useTabQueryHandler } from "@/composables/useTabQueryHandler";
  5. const MainHeader = defineAsyncComponent(
  6. () => import("@/components/MainHeader.vue")
  7. );
  8. const MainFooter = defineAsyncComponent(
  9. () => import("@/components/MainFooter.vue")
  10. );
  11. const SecuritySettings = defineAsyncComponent(
  12. () => import("./Tabs/Security.vue")
  13. );
  14. const AccountSettings = defineAsyncComponent(
  15. () => import("./Tabs/Account.vue")
  16. );
  17. const ProfileSettings = defineAsyncComponent(
  18. () => import("./Tabs/Profile.vue")
  19. );
  20. const PreferencesSettings = defineAsyncComponent(
  21. () => import("./Tabs/Preferences.vue")
  22. );
  23. const route = useRoute();
  24. const { tab, showTab } = useTabQueryHandler("");
  25. onMounted(async () => {
  26. if (
  27. route.query.tab === "profile" ||
  28. route.query.tab === "security" ||
  29. route.query.tab === "account" ||
  30. route.query.tab === "preferences"
  31. )
  32. tab.value = route.query.tab;
  33. else tab.value = "profile";
  34. });
  35. </script>
  36. <template>
  37. <div>
  38. <page-metadata title="Settings" />
  39. <main-header />
  40. <div class="container">
  41. <h1 id="page-title">Settings</h1>
  42. <div id="sidebar-with-content">
  43. <div class="nav-links">
  44. <a
  45. :class="{ active: tab === 'profile' }"
  46. @click="showTab('profile')"
  47. >
  48. Profile
  49. </a>
  50. <a
  51. :class="{ active: tab === 'account' }"
  52. @click="showTab('account')"
  53. >
  54. Account
  55. </a>
  56. <a
  57. :class="{ active: tab === 'security' }"
  58. @click="showTab('security')"
  59. >
  60. Security
  61. </a>
  62. <a
  63. :class="{ active: tab === 'preferences' }"
  64. @click="showTab('preferences')"
  65. >
  66. Preferences
  67. </a>
  68. </div>
  69. <profile-settings v-if="tab === 'profile'"></profile-settings>
  70. <account-settings v-if="tab === 'account'"></account-settings>
  71. <security-settings
  72. v-if="tab === 'security'"
  73. ></security-settings>
  74. <preferences-settings
  75. v-if="tab === 'preferences'"
  76. ></preferences-settings>
  77. </div>
  78. </div>
  79. <main-footer />
  80. </div>
  81. </template>
  82. <style lang="less" scoped>
  83. .night-mode {
  84. .container .content {
  85. box-shadow: 0 !important;
  86. }
  87. }
  88. :deep(.character-counter) {
  89. display: flex;
  90. justify-content: flex-end;
  91. height: 0;
  92. }
  93. .container {
  94. margin-top: 32px;
  95. padding: 24px;
  96. :deep(.row) {
  97. *:not(:last-child) {
  98. margin-right: 5px;
  99. }
  100. }
  101. .content {
  102. background-color: var(--white);
  103. padding: 30px 50px;
  104. border-radius: @border-radius;
  105. box-shadow: @box-shadow;
  106. }
  107. #sidebar-with-content {
  108. display: flex;
  109. flex-direction: column;
  110. }
  111. @media only screen and (min-width: 700px) {
  112. #sidebar-with-content {
  113. width: 962px;
  114. max-width: 100%;
  115. margin: 0 auto;
  116. flex-direction: row;
  117. .nav-links {
  118. margin-left: 0;
  119. margin-right: 64px;
  120. }
  121. .content {
  122. width: 600px;
  123. margin-top: 0px !important;
  124. }
  125. }
  126. }
  127. .nav-links {
  128. width: 250px;
  129. margin-left: auto;
  130. margin-right: auto;
  131. a {
  132. outline: none;
  133. border: none;
  134. box-shadow: 0;
  135. color: var(--primary-color);
  136. font-size: 22px;
  137. line-height: 26px;
  138. padding: 7px 0 7px 12px;
  139. width: 100%;
  140. text-align: left;
  141. cursor: pointer;
  142. border-radius: @border-radius;
  143. background-color: transparent;
  144. display: inline-block;
  145. &.active {
  146. color: var(--white);
  147. background-color: var(--primary-color);
  148. }
  149. }
  150. }
  151. :deep(.content) {
  152. margin: 24px 0;
  153. height: fit-content;
  154. .control:not(:first-of-type) {
  155. margin: 10px 0;
  156. }
  157. label {
  158. font-size: 14px;
  159. color: var(--dark-grey-2);
  160. }
  161. textarea {
  162. height: 96px;
  163. }
  164. button {
  165. width: 100%;
  166. margin-top: 30px;
  167. }
  168. }
  169. }
  170. </style>