HeaderBar.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="visible-in-print">
  3. <div class="flex items-center">
  4. <img
  5. src="../../assets/logo.svg"
  6. alt="Logo"
  7. width="45"
  8. height="45"
  9. class="mr-3 inline"
  10. >
  11. <div>
  12. <span class="font-bold text-2xl block">{{ SCHOOL_NAME }} Modulplaner</span>
  13. <span class="text-xs text-gray-400 block">Made with <font-awesome-icon icon="fa-solid fa-heart" /> by Sean
  14. Blackburn</span>
  15. </div>
  16. </div>
  17. </div>
  18. <div
  19. class="w-full bg-gray-800 dark:bg-black px-5 md:px-10 py-5 hidden-in-print flex justify-between gap-4 relative"
  20. >
  21. <!-- <img
  22. v-if="stateStore.hasShownHelpWantedModal"
  23. title="Nachfolger gesucht!"
  24. class="absolute h-full bottom-0 right-24 cursor-pointer hidden md:block"
  25. src="../../assets/searching-single.svg"
  26. @click="
  27. stateStore.hasShownHelpWantedModal = !stateStore.hasShownHelpWantedModal
  28. "
  29. /> -->
  30. <div class="flex items-center text-gray-200">
  31. <img
  32. src="../../assets/logo.svg"
  33. alt="Logo"
  34. width="42"
  35. height="42"
  36. class="mr-3"
  37. >
  38. <div class="hidden md:block">
  39. <span class="font-bold text-2xl block">{{ SCHOOL_NAME }} Modulplaner</span>
  40. <span class="text-xs text-gray-400 block">Made with <font-awesome-icon icon="fa-solid fa-heart" /> by Sean
  41. Blackburn</span>
  42. </div>
  43. </div>
  44. <div class="text-center text-gray-200 text-xs md:text-base">
  45. <p class="text-red-500">
  46. Alle Angaben ohne Gewähr! Bei Fehlern:
  47. <a
  48. title="Modulplaner GitLab Issues"
  49. class="text-blue-400 underline"
  50. target="_blank"
  51. rel="noreferrer noopener"
  52. :href="URLS.GITLAB_REPO_TICKET"
  53. >Ticket</a>
  54. </p>
  55. <p>
  56. <span class="hidden md:inline">PDF Version:</span>
  57. <Popper
  58. :arrow="true"
  59. :hover="true"
  60. :z-index="30"
  61. style="border: 0px solid transparent; margin: 0px"
  62. >
  63. <span
  64. class="p-1 px-2 ml-2 rounded inline text-xs md:text-sm font-mono"
  65. :class="[
  66. classVersionStore.isLatestSemesterVersion
  67. ? 'bg-gray-700 cursor-help'
  68. : 'bg-red-700 pulsating-orange p-1.5 px-4 cursor-pointer',
  69. ]"
  70. :title="
  71. !classVersionStore.isLatestSemesterVersion
  72. ? 'Click to upgrade'
  73. : 'Aktuellste Version'
  74. "
  75. @click="showClassUpgrader"
  76. >{{ currentVersionStr }}
  77. </span>
  78. <template #content>
  79. <span
  80. v-if="!classVersionStore.isLatestSemesterVersion"
  81. class="p-3 m-2 font-bold block dark:bg-orange-700 bg-orange-500 text-white rounded-md cursor-pointer"
  82. @click="showClassUpgrader"
  83. >Veraltete Stundenplan-Version!</span>
  84. Export: {{ configStore.config.export_date }}<br>
  85. Parse: {{ configStore.config.parse_date }}
  86. </template>
  87. </Popper>
  88. </p>
  89. </div>
  90. <div
  91. class="flex items-center justify-end"
  92. style="width: 42px"
  93. >
  94. <AdditionalInfo />
  95. </div>
  96. </div>
  97. </template>
  98. <script lang="ts">
  99. import { useConfigStore } from "../../stores/config";
  100. import Popper from "vue3-popper";
  101. import AdditionalInfo from "../modals/AdditionalInfo.vue";
  102. import { useClassVersionStore } from "../../stores/ClassVersion";
  103. import { useStateStore } from "../../stores/state";
  104. import { URLS, SCHOOL_NAME } from "../../helpers";
  105. export default {
  106. name: "HeaderBar",
  107. components: {
  108. Popper,
  109. AdditionalInfo,
  110. },
  111. setup() {
  112. const configStore = useConfigStore();
  113. const classVersionStore = useClassVersionStore();
  114. const stateStore = useStateStore();
  115. return {
  116. configStore,
  117. classVersionStore,
  118. stateStore,
  119. URLS,
  120. SCHOOL_NAME,
  121. };
  122. },
  123. computed: {
  124. currentVersionStr(): string {
  125. if (
  126. this.classVersionStore.semester == null &&
  127. this.classVersionStore.version == null
  128. )
  129. return "Laden...";
  130. if (this.classVersionStore.semester == "latest")
  131. return this.configStore.config.pdf_version;
  132. return `${this.classVersionStore.semester} / ${this.classVersionStore.version}`;
  133. },
  134. },
  135. methods: {
  136. showClassUpgrader() {
  137. if (this.classVersionStore.isLatestSemesterVersion) return;
  138. this.stateStore.upgradingClassVersion = true;
  139. },
  140. },
  141. };
  142. </script>
  143. <style scoped>
  144. .pulsating-orange {
  145. animation-name: color;
  146. animation-duration: 1s;
  147. animation-iteration-count: infinite;
  148. animation-direction: alternate;
  149. }
  150. @keyframes color {
  151. to {
  152. background-color: rgb(194 65 12);
  153. }
  154. }
  155. </style>