Merged with dev and fixed conflicts
This commit is contained in:
@ -45,6 +45,11 @@ export const getQuery = (
|
||||
orderByList,
|
||||
defaultOrderBy
|
||||
)
|
||||
if (typeof locationQuery.q === 'string') {
|
||||
query.q = locationQuery.q
|
||||
} else {
|
||||
delete query.q
|
||||
}
|
||||
|
||||
return query
|
||||
}
|
||||
|
@ -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',
|
||||
}
|
||||
|
39
fittrackee_client/src/utils/password.ts
Normal file
39
fittrackee_client/src/utils/password.ts
Normal 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'
|
||||
}
|
||||
}
|
@ -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[],
|
||||
|
@ -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',
|
||||
|
Reference in New Issue
Block a user