Skip to content

Commit

Permalink
managers folder
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyPouyet committed Nov 9, 2024
1 parent 2c156ab commit fd30843
Show file tree
Hide file tree
Showing 22 changed files with 42 additions and 42 deletions.
6 changes: 3 additions & 3 deletions src/account.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { newId, valueAs } from './helpers'
import type { ID, Transaction, TransactionFunctional, TransactionList } from './types'
import { Frequency, SortType, TransactionType } from './types'
import notificationManager, { NotificationType } from '@/notificationManager'
import userManager from './userManager'
import SettingsManager from './SettingsManager'
import notificationManager, { NotificationType } from '@/managers/notificationManager'
import userManager from './managers/userManager'
import SettingsManager from './managers/SettingsManager'

export enum AccountType {
Common = 'common',
Expand Down
2 changes: 1 addition & 1 deletion src/browserStorage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import notificationManager, { NotificationType } from '@/notificationManager'
import notificationManager, { NotificationType } from '@/managers/notificationManager'

export enum StorageKey {
SimulatorTab = 'simulatorTab', // Last active tab on the simulator
Expand Down
2 changes: 1 addition & 1 deletion src/components/FinanceInfoBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { computed } from 'vue'
import User from '@/user'
import type Account from '@/account'
import userManager from '@/userManager'
import userManager from '@/managers/userManager'
import { sexyAmount, sexyNumber } from '@/formaters'
const props = defineProps<{ commonAccount: Account, commonBill: number, remainSum: number, user: User }>()
Expand Down
2 changes: 1 addition & 1 deletion src/components/HistoryEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import NoteIcon from './NoteIcon.vue'
import { onMounted, ref } from 'vue'
import { sexyDate } from '@/formaters'
import historyManager, { type Sample } from '@/historyManager'
import historyManager, { type Sample } from '@/managers/historyManager'
import { useSticky } from '@/helpers'
const emit = defineEmits(['switchSample'])
Expand Down
12 changes: 6 additions & 6 deletions src/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import distributionIcon from '@/assets/icons/distribution.png'
import { computed, onMounted, ref, watch } from 'vue'
import { RouterLink, useRoute } from 'vue-router'
import db from '@/db'
import type { NotificationManager } from '@/notificationManager'
import type { HistoryManager } from '@/historyManager'
import type { UserManager } from '@/userManager'
import type { NotificationManager } from '@/managers/notificationManager'
import type { HistoryManager } from '@/managers/historyManager'
import type { UserManager } from '@/managers/userManager'
onMounted(() => {
import('bootstrap/js/dist/collapse')
Expand All @@ -35,9 +35,9 @@ let historyManager: HistoryManager
let userManager: UserManager
const loadManagers = async () => {
notificationManager = (await import('@/notificationManager')).default
historyManager = (await import('@/historyManager')).default
userManager = (await import('@/userManager')).default
notificationManager = (await import('@/managers/notificationManager')).default
historyManager = (await import('@/managers/historyManager')).default
userManager = (await import('@/managers/userManager')).default
}
async function historicise() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Note.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { nextTick, ref } from 'vue'
import type { Transaction } from '@/types'
import type { Sample } from '@/historyManager'
import type { Sample } from '@/managers/historyManager'
import type Account from '@/account'
import type { Expense } from '@/project'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Notifications.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { type ID } from '@/types'
import notificationManager, { NotificationType } from '@/notificationManager'
import notificationManager, { NotificationType } from '@/managers/notificationManager'
import { onMounted, onUpdated } from 'vue'
Expand Down
2 changes: 1 addition & 1 deletion src/components/TransactionsTable/TableContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type Account from '@/account'
import { AccountType } from '@/account'
import Texts from '@/texts'
import { Frequency, type TransactionFunctional, TransactionType } from '@/types'
import SettingsManager from '@/SettingsManager'
import SettingsManager from '@/managers/SettingsManager'
const props = defineProps<{
account: Account,
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserLine.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { nextTick, ref } from 'vue'
import User from '@/user'
import userManager from '@/userManager'
import userManager from '@/managers/userManager'
const props = defineProps<{ user: User }>()
Expand Down
2 changes: 1 addition & 1 deletion src/components/UsersEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import UserLine from './UserLine.vue'
import { ref } from 'vue'
import { useSticky } from '@/helpers'
import userManager from '@/userManager'
import userManager from '@/managers/userManager'
const username = ref<string>('')
const isSticky = useSticky()
Expand Down
2 changes: 1 addition & 1 deletion src/components/simulator/distribution.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import userManager from '@/userManager'
import userManager from '@/managers/userManager'
import { sexyAmount, sexyNumber } from '@/formaters'
defineProps<{ total: number }>()
Expand Down
6 changes: 3 additions & 3 deletions src/db.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { nextTick, reactive, ref, watch } from 'vue'

import historyManager, { type Sample } from './historyManager'
import historyManager, { type Sample } from './managers/historyManager'
import Account, { AccountType } from './account'
import userManager from './userManager'
import SettingsManager from './SettingsManager'
import userManager from './managers/userManager'
import SettingsManager from './managers/SettingsManager'

type Persistable = 'account' | 'history' | 'settings' | 'users'

Expand Down
2 changes: 1 addition & 1 deletion src/formaters.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SettingsManager, { CurrencyToLocale } from './SettingsManager'
import SettingsManager, { CurrencyToLocale } from './managers/SettingsManager'

/* eslint-disable sort-keys */
const dateTimeFormatOptions: Partial<Intl.DateTimeFormatOptions> = {
Expand Down
16 changes: 8 additions & 8 deletions src/SettingsManager.ts → src/managers/SettingsManager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { reactive } from 'vue'
import notificationManager from '@/notificationManager'
import notificationManager from '@/managers/notificationManager'
import Texts from '@/texts'
import { SortType } from './types'
import { SortType } from '../types'

// ISO 4217 currencies
export enum Currency {
Expand Down Expand Up @@ -67,9 +67,9 @@ class SettingsManager {
/**
* Retrieves the currency symbol for a given currency.
*
* @param {Currency} [currency] - Currency to get the symbol for. Defaults to current setting.
* @param {boolean} [with_iso_code=false] - Whether to append the ISO code to the symbol.
* @returns {string} The currency symbol, optionally with ISO code.
* @param currency - Currency to get the symbol for. Defaults to current setting.
* @param with_iso_code - Whether to append the ISO code to the symbol.
* @returns The currency symbol, optionally with ISO code.
*/
getCurrencySymbol(currency?: Currency, with_iso_code = false) : string {
currency ||= this.settings.currency
Expand All @@ -85,7 +85,7 @@ class SettingsManager {
/**
* Checks if the currency symbol of the currency in the settings is positioned after the value.
*
* @returns {boolean} True if symbol is on the right; false otherwise.
* @returns True if symbol is on the right; false otherwise.
*/
isCurrencySymbolOnRight() : boolean {
return Intl.NumberFormat(
Expand All @@ -108,8 +108,8 @@ class SettingsManager {
/**
* Updates a setting and generates a notification
*
* @param {String} setting Name of the setting to update
* @param {Any} value New setting value
* @param setting Name of the setting to update
* @param value New setting value
*/
update<K extends GlobalSettingsKey>(setting: K, value: GlobalSettings[K]): void {
this.settings[setting] = value
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ref, type Ref } from 'vue'
import type { ID } from './types'
import { newId } from './helpers'
import type { ID } from '../types'
import { newId } from '../helpers'

export enum NotificationType {
Success = 'success',
Expand Down
2 changes: 1 addition & 1 deletion src/userManager.ts → src/managers/userManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { reactive } from 'vue'
import User from './user'
import User from '../user'

class UserManager {
readonly users = reactive<User[]>([])
Expand Down
2 changes: 1 addition & 1 deletion src/project.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { newId } from '@/helpers'
import type { ID } from '@/types'
import { SortType } from '@/types'
import SettingsManager from '@/SettingsManager'
import SettingsManager from '@/managers/SettingsManager'

export interface Expense {
readonly id: ID
Expand Down
2 changes: 1 addition & 1 deletion src/views/Budget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import UsersEdit from '@/components/UsersEdit.vue'
import BudgetShow from '@/components/BudgetShow.vue'
import db from '@/db'
import userManager from '@/userManager'
import userManager from '@/managers/userManager'
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion src/views/History.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import BudgetShow from '@/components/BudgetShow.vue'
import { onUnmounted, ref, watch } from 'vue'
import DBSnapshot from '@/dbSnapshot'
import historyManager, { type Sample } from '@/historyManager'
import historyManager, { type Sample } from '@/managers/historyManager'
let userWatcherCleanup: (() => void) | null = null
let accountWatcherCleanup: (() => void) | null = null
Expand Down
6 changes: 3 additions & 3 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import '@/assets/secondary.scss'
import db from '@/db'
import historyManager from '@/historyManager'
import notificationManager, { NotificationType } from '@/notificationManager'
import SettingsManager, { Currency } from '@/SettingsManager'
import historyManager from '@/managers/historyManager'
import notificationManager, { NotificationType } from '@/managers/notificationManager'
import SettingsManager, { Currency } from '@/managers/SettingsManager'
import { SortType } from '@/types'
import Texts from '@/texts'
import { computed } from 'vue'
Expand Down
6 changes: 3 additions & 3 deletions src/views/Simulator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import NoteIcon from '@/components/NoteIcon.vue'
import { computed, nextTick, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
import { limitedEvaluate } from '@/helpers'
import SettingsManager from '@/SettingsManager'
import SettingsManager from '@/managers/SettingsManager'
import { sexyAmount } from '@/formaters'
import Project, { type Expense } from '@/project'
import Distribution from '@/components/simulator/distribution.vue'
Expand Down Expand Up @@ -99,14 +99,14 @@ function handleClickOutside(event: MouseEvent) : void {
<div class="row">
<div class="col-auto mb-4">
<div :class="['row char-width-30 sticky-top']">
<div class="row">
<div v-if="activeTab === 'advanced'" class="row">
<h3>Mes projets</h3>
<hr>
</div>
</div>
</div>
<div class="col">
<ul class="nav nav-underline">
<ul class="nav nav-underline mb-3">
<li class="nav-item">
<a
class="nav-link"
Expand Down

0 comments on commit fd30843

Please sign in to comment.