mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
refactor: avoid directly importing all methods from ~/utils
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import type { Ref } from 'vue'
|
||||
import { grantAccessKey, revokeAccessKey } from '~/utils/index'
|
||||
import { grantAccessKey, revokeAccessKey } from '~/utils/authProvider'
|
||||
import { accessKey, settings } from '~/logic'
|
||||
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { Ref, UnwrapNestedRefs } from 'vue'
|
||||
import { Transition, onMounted, watch } from 'vue'
|
||||
import type { UnReadDm, UnReadMessage, UserInfo } from './types'
|
||||
import { updateInterval } from './notify'
|
||||
import { getUserID } from '~/utils'
|
||||
import { getUserID } from '~/utils/main'
|
||||
|
||||
interface Props {
|
||||
showSearchBar: boolean
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
import type { Ref } from 'vue'
|
||||
import { TransitionGroup, onMounted, reactive, ref, watch } from 'vue'
|
||||
import type { FavoriteCategory, FavoriteResource } from './types'
|
||||
import { calcCurrentTime, getUserID, removeHttpFromUrl } from '~/utils'
|
||||
import { getUserID, removeHttpFromUrl } from '~/utils/main'
|
||||
import { calcCurrentTime } from '~/utils/dataFormatter'
|
||||
|
||||
const favoriteCategories = reactive<Array<FavoriteCategory>>([])
|
||||
const favoriteResources = reactive<Array<FavoriteResource>>([])
|
||||
|
||||
@@ -5,7 +5,8 @@ import { onMounted, reactive, ref, watch } from 'vue'
|
||||
import { useDateFormat } from '@vueuse/core'
|
||||
import type { HistoryItem } from './types'
|
||||
import { HistoryType } from './types'
|
||||
import { calcCurrentTime, removeHttpFromUrl } from '~/utils'
|
||||
import { removeHttpFromUrl } from '~/utils/main'
|
||||
import { calcCurrentTime } from '~/utils/dataFormatter'
|
||||
const { t } = useI18n()
|
||||
|
||||
const historys = reactive<Array<HistoryItem>>([])
|
||||
|
||||
@@ -5,7 +5,8 @@ import { onMounted, reactive, ref, watch } from 'vue'
|
||||
import { isNewArticle, isNewVideo, setLastestOffsetID } from './notify'
|
||||
import { MomentType } from './types'
|
||||
import type { MomentItem } from './types'
|
||||
import { calcTimeSince, getUserID } from '~/utils'
|
||||
import { getUserID } from '~/utils/main'
|
||||
import { calcTimeSince } from '~/utils/dataFormatter'
|
||||
const { t } = useI18n()
|
||||
|
||||
const moments = reactive<Array<MomentItem>>([]) as UnwrapNestedRefs<
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { getUserID } from '~/utils'
|
||||
import { getUserID } from '~/utils/main'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue'
|
||||
import { revokeAccessKey } from '../../utils/index'
|
||||
import { getCSRF, getUserID, numFormatter } from '~/utils'
|
||||
import { revokeAccessKey } from '~/utils/authProvider'
|
||||
import { getCSRF, getUserID } from '~/utils/main'
|
||||
import { numFormatter } from '~/utils/dataFormatter'
|
||||
export default defineComponent({
|
||||
props: {
|
||||
userInfo: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MomentType } from './types'
|
||||
import { getCookie, getUserID, setCookie } from '~/utils'
|
||||
import { getCookie, getUserID, setCookie } from '~/utils/main'
|
||||
|
||||
/** Update the time interval of topbar notifications and moments counts */
|
||||
export const updateInterval = 1000 * 60 * 5 // Updated every 5 minutes
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import type { Ref } from 'vue'
|
||||
// import { accessKey, language } from '~/logic/index'
|
||||
import {
|
||||
calcCurrentTime,
|
||||
calcTimeSince,
|
||||
numFormatter,
|
||||
removeHttpFromUrl,
|
||||
} from '~/utils'
|
||||
// import { LanguageType } from '~/enums/appEnums'
|
||||
import { removeHttpFromUrl } from '~/utils/main'
|
||||
import { calcCurrentTime, calcTimeSince, numFormatter } from '~/utils/dataFormatter'
|
||||
|
||||
const props = defineProps<{
|
||||
duration: number
|
||||
|
||||
@@ -3,7 +3,8 @@ import { createApp } from 'vue'
|
||||
import type { App as AppType } from 'vue'
|
||||
import App from './views/App.vue'
|
||||
import { setupApp } from '~/logic/common-setup'
|
||||
import { SVG_ICONS, i18n } from '~/utils'
|
||||
import { i18n } from '~/utils/i18n'
|
||||
import { SVG_ICONS } from '~/utils/svgIcons'
|
||||
|
||||
let app: AppType | null = null;
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ import AnimeTimeTable from './components/AnimeTimeTable.vue'
|
||||
import AnimeCard from './components/AnimeCard.vue'
|
||||
import AnimeCardSkeleton from './components/AnimeCardSkeleton.vue'
|
||||
import type { AnimeItem, PopularAnime } from './types'
|
||||
import { getUserID, numFormatter, openLinkToNewTab, removeHttpFromUrl } from '~/utils'
|
||||
import { getUserID, openLinkToNewTab, removeHttpFromUrl } from '~/utils/main'
|
||||
import { numFormatter } from '~/utils/dataFormatter'
|
||||
|
||||
const animeWatchList = reactive<AnimeItem[]>([])
|
||||
const recommendAnimeList = reactive<AnimeItem[]>([])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { removeHttpFromUrl } from '~/utils'
|
||||
import { removeHttpFromUrl } from '~/utils/main'
|
||||
|
||||
defineProps<{
|
||||
url: string
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { Ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import browser from 'webextension-polyfill'
|
||||
import type { AnimeTimeTableItem } from '../types'
|
||||
import { removeHttpFromUrl } from '~/utils'
|
||||
import { removeHttpFromUrl } from '~/utils/main'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import Video from './Video/Video.vue'
|
||||
import { activatedPage, settings } from '~/logic'
|
||||
import '~/styles/index.ts'
|
||||
import { AppPage, LanguageType } from '~/enums/appEnums'
|
||||
import { hexToRGBA } from '~/utils'
|
||||
import { hexToRGBA } from '~/utils/main'
|
||||
|
||||
const { locale } = useI18n()
|
||||
const [showSettings, toggle] = useToggle(false)
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
import type { Ref } from 'vue'
|
||||
import { TransitionGroup, onMounted, reactive, ref, watch } from 'vue'
|
||||
import type { FavoriteCategory, FavoriteResource } from './types'
|
||||
import { calcCurrentTime, getUserID, removeHttpFromUrl } from '~/utils'
|
||||
import { getUserID, removeHttpFromUrl } from '~/utils/main'
|
||||
import { calcCurrentTime } from '~/utils/dataFormatter'
|
||||
|
||||
const favoriteCategories = reactive<Array<FavoriteCategory>>([])
|
||||
const favoriteResources = reactive<Array<FavoriteResource>>([])
|
||||
|
||||
@@ -3,12 +3,8 @@ import { useDateFormat } from '@vueuse/core'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { HistoryType } from './types'
|
||||
import type { HistoryItem } from './types'
|
||||
import {
|
||||
calcCurrentTime,
|
||||
getCSRF,
|
||||
openLinkToNewTab,
|
||||
removeHttpFromUrl,
|
||||
} from '~/utils'
|
||||
import { getCSRF, openLinkToNewTab, removeHttpFromUrl } from '~/utils/main'
|
||||
import { calcCurrentTime } from '~/utils/dataFormatter'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
import type { Ref, UnwrapNestedRefs } from 'vue'
|
||||
import { useDateFormat } from '@vueuse/core'
|
||||
import type { Comment, UserCardInfo, VideoInfo } from './types'
|
||||
import { calcTimeSince, getCSRF, numFormatter, removeHttpFromUrl } from '~/utils'
|
||||
import { getCSRF, removeHttpFromUrl } from '~/utils/main'
|
||||
import { calcTimeSince, numFormatter } from '~/utils/dataFormatter'
|
||||
|
||||
const videoContent = ref() as Ref<HTMLElement>
|
||||
// const commentContent = ref() as Ref<HTMLElement>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
export * from './authProvider'
|
||||
export * from './svgIcons'
|
||||
export * from './i18n'
|
||||
export * from './dataFormatter'
|
||||
export * from './main'
|
||||
Reference in New Issue
Block a user