Merged with dev and fixed conflicts

This commit is contained in:
Fmstrat
2022-07-18 09:16:17 -04:00
349 changed files with 17812 additions and 7523 deletions

View File

@ -45,6 +45,11 @@ export const getQuery = (
orderByList,
defaultOrderBy
)
if (typeof locationQuery.q === 'string') {
query.q = locationQuery.q
} else {
delete query.q
}
return query
}

View File

@ -1,15 +1,17 @@
/* eslint-disable import/no-duplicates */
import { Locale } from 'date-fns'
import { enUS, fr } from 'date-fns/locale'
import { de, enUS, fr } from 'date-fns/locale'
import createI18n from '@/i18n'
export const localeFromLanguage: Record<string, Locale> = {
de: de,
en: enUS,
fr: fr,
}
export const languageLabels: Record<string, string> = {
de: 'Deutsch',
en: 'English',
fr: 'Français',
}

View File

@ -0,0 +1,39 @@
import { zxcvbnOptions } from '@zxcvbn-ts/core'
export const setZxcvbnOptions = async (language: string) => {
const zxcvbnCommonPackage = await import(
/* webpackChunkName: "password" */ '@zxcvbn-ts/language-common'
)
const zxcvbnEnPackage = await import(
/* webpackChunkName: "password" */ '@zxcvbn-ts/language-en'
)
const zxcvbnFrPackage = await import(
/* webpackChunkName: "password" */ '@zxcvbn-ts/language-fr'
)
const zxcvbnLangPackages: Record<string, typeof zxcvbnEnPackage> = {
en: zxcvbnEnPackage,
fr: zxcvbnFrPackage,
}
const zxcvbnPackage = zxcvbnLangPackages[language]
const options = {
graphs: zxcvbnCommonPackage.default.adjacencyGraphs,
dictionary: {
...zxcvbnCommonPackage.default.dictionary,
...zxcvbnPackage.default.dictionary,
},
}
zxcvbnOptions.setOptions(options)
}
export const getPasswordStrength = (strength: number): string => {
switch (strength) {
case 2:
return 'AVERAGE'
case 3:
return 'GOOD'
case 4:
return 'STRONG'
default:
return 'WEAK'
}
}

View File

@ -1,6 +1,6 @@
import { ITranslatedSport } from '@/types/sports'
import { TUnit } from '@/types/units'
import { IRecord, IRecordsBySports } from '@/types/workouts'
import { ICardRecord, IRecord, IRecordsBySports } from '@/types/workouts'
import { formatWorkoutDate, getDateWithTZ } from '@/utils/dates'
import { convertDistance, units } from '@/utils/units'
@ -52,6 +52,12 @@ export const formatRecord = (
}
}
export const sortRecords = (a: ICardRecord, b: ICardRecord): number => {
const recordALabel = a.label.toLowerCase()
const recordBLabel = b.label.toLowerCase()
return recordALabel > recordBLabel ? 1 : recordALabel < recordBLabel ? -1 : 0
}
export const getRecordsBySports = (
records: IRecord[],
translatedSports: ITranslatedSport[],

View File

@ -1,7 +1,6 @@
import { ISport, ITranslatedSport, TActiveStatus } from '@/types/sports'
import { IWorkout } from '@/types/workouts'
// TODO: allow user to change colors
export const sportColors: Record<string, string> = {
'Cycling (Sport)': '#4c9792',
'Cycling (Transport)': '#88af98',