Browse Source

Maintenance: Resolve TODOs in mobile context

Vladimir Sheremet 1 year ago
parent
commit
abb2719f17

+ 12 - 0
.eslintrc.js

@@ -1,6 +1,10 @@
 // Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
 
 const path = require('path')
+const fs = require('fs')
+
+const pagesDir = path.resolve(__dirname, 'app/frontend/apps/mobile/pages')
+const pagesFolder = fs.readdirSync(pagesDir)
 
 module.exports = {
   root: true,
@@ -79,10 +83,18 @@ module.exports = {
       'error',
       {
         zones: [
+          // restrict import inside shared context from app context
           {
             target: './app/frontend/shared',
             from: './app/frontend/apps',
           },
+          // restrict imports between different pages folder
+          ...pagesFolder.map((page) => {
+            return {
+              target: `./app/frontend/apps/mobile/pages/!(${page})/**/*`,
+              from: `./app/frontend/apps/mobile/pages/${page}/**/*`,
+            }
+          }),
         ],
       },
     ],

+ 0 - 1
app/frontend/apps/mobile/components/CommonSectionMenu/CommonSectionMenuLink.vue

@@ -12,7 +12,6 @@ export interface Props {
   linkExternal?: boolean
   icon?: string | (IconProps & HTMLAttributes)
   iconBg?: string
-  // TODO maybe change the name based on the usage
   information?: string | number
 }
 

+ 0 - 3
app/frontend/apps/mobile/components/CommonSectionPopup/index.ts

@@ -1,3 +0,0 @@
-// Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
-
-export * from './types.ts'

+ 0 - 1
app/frontend/apps/mobile/components/CommonSelect/__tests__/CommonSelect.spec.ts

@@ -61,7 +61,6 @@ describe('interacting with CommonSelect', () => {
     await view.events.click(view.getByText('Open Select'))
 
     expect(
-      // TODO should work just with view.getByIconName('mobile-check') with Vitest 0.19
       view.getByIconName((name, node) => {
         return (
           name === '#icon-mobile-check' &&

+ 1 - 1
app/frontend/apps/mobile/components/CommonUsersList/CommonUsersList.vue

@@ -1,7 +1,7 @@
 <!-- Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ -->
 
 <script setup lang="ts">
-import type { AvatarUser } from '#shared/components/CommonUserAvatar/index.ts'
+import type { AvatarUser } from '#shared/components/CommonUserAvatar/types.ts'
 import CommonUserAvatar from '#shared/components/CommonUserAvatar/CommonUserAvatar.vue'
 
 interface Props {

+ 0 - 1
app/frontend/apps/mobile/components/Form/fields/FieldSelect/__tests__/FieldSelect.spec.ts

@@ -115,7 +115,6 @@ describe('Form - Field - Select - Dialog', () => {
     ).toHaveClass('font-semibold')
 
     expect(
-      // TODO should work just with view.getByIconName('mobile-check') with Vitest 0.19
       wrapper.getByIconName((name, node) => {
         return (
           name === '#icon-mobile-check' &&

+ 0 - 49
app/frontend/apps/mobile/components/transition/TransitionViewNavigation/TransitionViewNavigation.story.vue

@@ -1,49 +0,0 @@
-<!-- Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ -->
-
-<script setup lang="ts">
-import { defineComponent, h, ref } from 'vue'
-import { useViewTransition } from './useViewTransition.ts'
-import TransitionViewNavigation from './TransitionViewNavigation.vue'
-import { ViewTransitions } from './types.ts'
-
-const FirstView = defineComponent(() => () => h('div', 'First View'))
-const SecondView = defineComponent(() => () => h('div', 'Second View'))
-
-const { setViewTransition } = useViewTransition()
-const component = ref('first')
-const transition = ref(ViewTransitions.Next)
-
-const switchView = () => {
-  setViewTransition(transition.value)
-  component.value = 'second'
-}
-
-const resetView = () => {
-  setViewTransition(ViewTransitions.Replace)
-  component.value = 'first'
-}
-</script>
-
-<template>
-  <Story>
-    <Variant title="Default">
-      <template #controls>
-        <HstSelect
-          v-model="transition"
-          title="Transition"
-          :options="ViewTransitions"
-        />
-      </template>
-
-      <button @click="switchView()">Switch View</button>
-
-      <button @click="resetView()">Reset View</button>
-
-      <TransitionViewNavigation>
-        <component :is="component === 'first' ? FirstView : SecondView" />
-        <!-- <FirstView v-if="component === 'first'" /> -->
-        <!-- <SecondView v-else-if="component === 'second'" /> -->
-      </TransitionViewNavigation>
-    </Variant>
-  </Story>
-</template>

+ 1 - 1
app/frontend/apps/mobile/entities/ticket/types.ts

@@ -21,7 +21,7 @@ export interface TicketInformation {
   form: ShallowRef<FormRef | undefined>
   updateFormLocation: (newLocation: string) => void
   canUpdateTicket: ComputedRef<boolean>
-  showArticleReplyDialog: () => void
+  showArticleReplyDialog: () => Promise<void>
   liveUserList?: Ref<TicketLiveAppUser[]>
   refetchingStatus: Ref<boolean>
   newArticlesIds: Set<string>

+ 0 - 1
app/frontend/apps/mobile/form/defineFormSchema.ts

@@ -6,7 +6,6 @@ type FormSchemaOptions = {
   showDirtyMark: boolean
 }
 
-// TODO: do we need this in future like that?
 export const defineFormSchema = (
   schema: FormSchemaNode[],
   options?: FormSchemaOptions,

+ 1 - 1
app/frontend/apps/mobile/pages/online-notification/components/NotificationItem.vue

@@ -6,7 +6,7 @@ import type {
   ActivityMessageMetaObject,
   Scalars,
 } from '#shared/graphql/types.ts'
-import type { AvatarUser } from '#shared/components/CommonUserAvatar/index.ts'
+import type { AvatarUser } from '#shared/components/CommonUserAvatar/types.ts'
 import { MutationHandler } from '#shared/server/apollo/handler/index.ts'
 import type { ApolloCache, InMemoryCache } from '@apollo/client'
 import { useOnlineNotificationDeleteMutation } from '#shared/entities/online-notification/graphql/mutations/delete.api.ts'

Some files were not shown because too many files changed in this diff