106 lines
3.5 KiB
TypeScript
106 lines
3.5 KiB
TypeScript
import { DecisionsChoice } from './use-steps';
|
|
|
|
export enum ZodiacSign {
|
|
Aries = 'Aries',
|
|
Taurus = 'Taurus',
|
|
Gemini = 'Gemini',
|
|
Cancer = 'Cancer',
|
|
Leo = 'Leo',
|
|
Virgo = 'Virgo',
|
|
Libra = 'Libra',
|
|
Scorpio = 'Scorpio',
|
|
Sagittarius = 'Sagittarius',
|
|
Capricorn = 'Capricorn',
|
|
Aquarius = 'Aquarius',
|
|
Pisces = 'Pisces',
|
|
}
|
|
|
|
export default function useZodiacSign() {
|
|
const getSignByDate = (month: number, day: number): ZodiacSign => {
|
|
if ((month === 3 && day >= 21) || (month === 4 && day <= 19)) return ZodiacSign.Aries;
|
|
if ((month === 4 && day >= 20) || (month === 5 && day <= 20)) return ZodiacSign.Taurus;
|
|
if ((month === 5 && day >= 21) || (month === 6 && day <= 20)) return ZodiacSign.Gemini;
|
|
if ((month === 6 && day >= 21) || (month === 7 && day <= 22)) return ZodiacSign.Cancer;
|
|
if ((month === 7 && day >= 23) || (month === 8 && day <= 22)) return ZodiacSign.Leo;
|
|
if ((month === 8 && day >= 23) || (month === 9 && day <= 22)) return ZodiacSign.Virgo;
|
|
if ((month === 9 && day >= 23) || (month === 10 && day <= 22)) return ZodiacSign.Libra;
|
|
if ((month === 10 && day >= 23) || (month === 11 && day <= 21)) return ZodiacSign.Scorpio;
|
|
if ((month === 11 && day >= 22) || (month === 12 && day <= 21)) return ZodiacSign.Sagittarius;
|
|
if ((month === 12 && day >= 22) || (month === 1 && day <= 19)) return ZodiacSign.Capricorn;
|
|
if ((month === 1 && day >= 20) || (month === 2 && day <= 18)) return ZodiacSign.Aquarius;
|
|
if ((month === 2 && day >= 19) || (month === 3 && day <= 20)) return ZodiacSign.Pisces;
|
|
|
|
throw new Error('Invalid date');
|
|
}
|
|
|
|
const getDecisionMakingStatistics = (sign: ZodiacSign) => {
|
|
return {
|
|
[ZodiacSign.Aries]: {
|
|
[DecisionsChoice.Heart]: 49,
|
|
[DecisionsChoice.Head]: 35,
|
|
[DecisionsChoice.Both]: 16,
|
|
},
|
|
[ZodiacSign.Taurus]: {
|
|
[DecisionsChoice.Heart]: 48,
|
|
[DecisionsChoice.Head]: 31,
|
|
[DecisionsChoice.Both]: 21,
|
|
},
|
|
[ZodiacSign.Gemini]: {
|
|
[DecisionsChoice.Heart]: 33,
|
|
[DecisionsChoice.Head]: 48,
|
|
[DecisionsChoice.Both]: 19,
|
|
},
|
|
[ZodiacSign.Cancer]: {
|
|
[DecisionsChoice.Heart]: 44,
|
|
[DecisionsChoice.Head]: 39,
|
|
[DecisionsChoice.Both]: 17,
|
|
},
|
|
[ZodiacSign.Leo]: {
|
|
[DecisionsChoice.Heart]: 30,
|
|
[DecisionsChoice.Head]: 55,
|
|
[DecisionsChoice.Both]: 15,
|
|
},
|
|
[ZodiacSign.Virgo]: {
|
|
[DecisionsChoice.Heart]: 38,
|
|
[DecisionsChoice.Head]: 40,
|
|
[DecisionsChoice.Both]: 22,
|
|
},
|
|
[ZodiacSign.Libra]: {
|
|
[DecisionsChoice.Heart]: 36,
|
|
[DecisionsChoice.Head]: 46,
|
|
[DecisionsChoice.Both]: 18,
|
|
},
|
|
[ZodiacSign.Scorpio]: {
|
|
[DecisionsChoice.Heart]: 29,
|
|
[DecisionsChoice.Head]: 52,
|
|
[DecisionsChoice.Both]: 19,
|
|
},
|
|
[ZodiacSign.Sagittarius]: {
|
|
[DecisionsChoice.Heart]: 29,
|
|
[DecisionsChoice.Head]: 53,
|
|
[DecisionsChoice.Both]: 18,
|
|
},
|
|
[ZodiacSign.Capricorn]: {
|
|
[DecisionsChoice.Heart]: 28,
|
|
[DecisionsChoice.Head]: 56,
|
|
[DecisionsChoice.Both]: 16,
|
|
},
|
|
[ZodiacSign.Aquarius]: {
|
|
[DecisionsChoice.Heart]: 27,
|
|
[DecisionsChoice.Head]: 55,
|
|
[DecisionsChoice.Both]: 18,
|
|
},
|
|
[ZodiacSign.Pisces]: {
|
|
[DecisionsChoice.Heart]: 42,
|
|
[DecisionsChoice.Head]: 38,
|
|
[DecisionsChoice.Both]: 20,
|
|
},
|
|
}[sign];
|
|
};
|
|
|
|
return {
|
|
getSignByDate,
|
|
getDecisionMakingStatistics,
|
|
};
|
|
}
|