services.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. export type AgeVal = '1' | '2' | '3' | '4' | '5' | '6';
  2. export type GenderVal = 'female' | 'male' | 'other';
  3. export type NonNativeVal = '1' | '2' | '3' | '4';
  4. export type FilterVal = 'age' | 'gender' | 'nonNative' | 'levelEducation';
  5. export type EducationVal = '1' | '2' | '3' | '4';
  6. export type Filters = {
  7. [filter in FilterVal]?: string[];
  8. } & {
  9. age?: AgeVal[],
  10. gender?: GenderVal[],
  11. nonNative?: NonNativeVal[],
  12. levelEducation?: EducationVal[],
  13. };
  14. export type FilterStatus = Record<FilterVal, boolean>
  15. const AGE: { [k in AgeVal]: string } = {
  16. '1': '16 - 17',
  17. '2': '18 - 25',
  18. '3': '26 - 45',
  19. '4': '46 - 65',
  20. '5': '66 - 75',
  21. '6': '75+'
  22. };
  23. const NON_NATIVE: { [k in NonNativeVal]: string } = {
  24. '1': 'Less than two years',
  25. '2': '3-5 years',
  26. '3': '6-10 years',
  27. '4': '10+ years'
  28. }
  29. const EDUCATION: { [k in EducationVal]: string } = {
  30. '1': 'High school or lower',
  31. '2': 'Bachelors',
  32. '3': 'Masters',
  33. '4': 'Doctorate'
  34. }
  35. const GENDER: GenderVal[] = [ 'female', 'male', 'other' ];
  36. const FILTER_KEYS: FilterVal[] = [
  37. 'age',
  38. 'gender',
  39. 'nonNative',
  40. 'levelEducation'
  41. ];
  42. const FILTER: Filters = {
  43. age: [ '1', '2', '3', '4', '5', '6' ],
  44. gender: [ ...GENDER ],
  45. nonNative: ['1', '2', '3', '4'],
  46. levelEducation: ['1', '2', '3', '4']
  47. }
  48. const CLEAN_FILTER: Filters = {
  49. age: [],
  50. gender: [],
  51. nonNative: [],
  52. levelEducation: []
  53. };
  54. export default {
  55. AGE,
  56. NON_NATIVE,
  57. GENDER,
  58. EDUCATION,
  59. FILTER,
  60. CLEAN_FILTER,
  61. FILTER_KEYS
  62. };