You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
2.6 KiB

  1. <template>
  2. <v-app-bar
  3. app
  4. clipped-left
  5. >
  6. <slot name="leftDrawerIcon" />
  7. <nuxt-link
  8. v-if="!isAuthenticated"
  9. to="/"
  10. style="line-height:0;"
  11. >
  12. <img src="~/assets/icon.png" height="48">
  13. </nuxt-link>
  14. <v-toolbar-title
  15. v-if="!isAuthenticated"
  16. class="ml-2 d-none d-sm-flex"
  17. >
  18. doccano
  19. </v-toolbar-title>
  20. <div class="flex-grow-1" />
  21. <the-color-mode-switcher />
  22. <v-btn
  23. v-if="isAuthenticated"
  24. text
  25. @click="$router.push('/projects')"
  26. >
  27. Projects
  28. </v-btn>
  29. <v-menu
  30. v-if="!isAuthenticated"
  31. open-on-hover
  32. offset-y
  33. >
  34. <template v-slot:activator="{ on }">
  35. <v-btn
  36. text
  37. v-on="on"
  38. >
  39. Demo
  40. <v-icon>mdi-menu-down</v-icon>
  41. </v-btn>
  42. </template>
  43. <v-list>
  44. <v-list-item
  45. v-for="(item, index) in items"
  46. :key="index"
  47. @click="$router.push('/demo/' + item.link)"
  48. >
  49. <v-list-item-title>{{ item.title }}</v-list-item-title>
  50. </v-list-item>
  51. </v-list>
  52. </v-menu>
  53. <v-btn
  54. v-if="!isAuthenticated"
  55. outlined
  56. @click="$router.push('/auth')"
  57. >
  58. Sign in
  59. </v-btn>
  60. <v-menu
  61. v-if="isAuthenticated"
  62. bottom
  63. >
  64. <template v-slot:activator="{ on }">
  65. <v-btn
  66. icon
  67. v-on="on"
  68. >
  69. <v-icon>mdi-dots-vertical</v-icon>
  70. </v-btn>
  71. </template>
  72. <v-list>
  73. <v-list-item @click="signout">
  74. <v-list-item-icon>
  75. <v-icon>mdi-logout</v-icon>
  76. </v-list-item-icon>
  77. <v-list-item-content>
  78. <v-list-item-title>
  79. Sign out
  80. </v-list-item-title>
  81. </v-list-item-content>
  82. </v-list-item>
  83. </v-list>
  84. </v-menu>
  85. </v-app-bar>
  86. </template>
  87. <script>
  88. import { mapGetters, mapActions } from 'vuex'
  89. import TheColorModeSwitcher from '@/components/organisms/layout/TheColorModeSwitcher'
  90. export default {
  91. components: {
  92. TheColorModeSwitcher
  93. },
  94. data() {
  95. return {
  96. items: [
  97. { title: 'Named Entity Recognition', link: 'named-entity-recognition' },
  98. { title: 'Sentiment Analysis', link: 'sentiment-analysis' },
  99. { title: 'Translation', link: 'translation' },
  100. { title: 'Text to SQL', link: 'text-to-sql' }
  101. ]
  102. }
  103. },
  104. computed: {
  105. ...mapGetters('auth', ['isAuthenticated'])
  106. },
  107. methods: {
  108. ...mapActions('auth', ['logout']),
  109. signout() {
  110. this.logout()
  111. this.$router.push('/')
  112. }
  113. }
  114. }
  115. </script>