services.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. export type AgeVal = '1' | '2' | '3' | '4' | '5' | '6';
  2. export type GenderVal = 'female' | 'male' | 'other';
  3. export type EthnicityVal =
  4. 'English/Welsh/Scottish/Northern Irish/British' |
  5. 'Irish' |
  6. 'Gypsy or Irish Traveller' |
  7. 'White and Black Caribbean' |
  8. 'White and Black African' |
  9. 'White and Asian' |
  10. 'Indian' |
  11. 'Pakistani' |
  12. 'Bangladeshi' |
  13. 'Chinese' |
  14. 'African' |
  15. 'Caribbean' |
  16. 'Arab' |
  17. 'other';
  18. export type NonNativeVal = '1' | '2' | '3' | '4';
  19. export type FilterVal = 'age' | 'gender' | 'ethnicity' | 'nonNative';
  20. export type Filters = {
  21. [filter in FilterVal]?: string[];
  22. } & {
  23. age?: AgeVal[];
  24. gender?: GenderVal[];
  25. ethnicity?: EthnicityVal[];
  26. nonNative?: NonNativeVal[];
  27. };
  28. export type FilterStatus = Record<FilterVal, boolean>
  29. const AGE: { [k in AgeVal]: string } = {
  30. '1': '11 - 17',
  31. '2': '18 - 25',
  32. '3': '26 - 45',
  33. '4': '46 - 65',
  34. '5': '66 - 75',
  35. '6': '75+'
  36. };
  37. const NON_NATIVE: { [k in NonNativeVal]: string } = {
  38. '1': 'Less than two years',
  39. '2': '3-5 years',
  40. '3': '6-10 years',
  41. '4': '10+ years'
  42. }
  43. const GENDER: GenderVal[] = [ 'female', 'male', 'other' ];
  44. const ETHNICITY: EthnicityVal[] = [
  45. 'English/Welsh/Scottish/Northern Irish/British',
  46. 'Irish',
  47. 'Gypsy or Irish Traveller',
  48. 'White and Black Caribbean',
  49. 'White and Black African',
  50. 'White and Asian',
  51. 'Indian',
  52. 'Pakistani',
  53. 'Bangladeshi',
  54. 'Chinese',
  55. 'African',
  56. 'Caribbean',
  57. 'Arab',
  58. 'other'
  59. ];
  60. const FILTER_KEYS: FilterVal[] = [
  61. 'age',
  62. 'gender',
  63. 'ethnicity',
  64. 'nonNative'
  65. ];
  66. const FILTER: Filters = {
  67. age: [ '1', '2', '3', '4', '5', '6' ],
  68. gender: [ ...GENDER ],
  69. ethnicity: [ ...ETHNICITY ],
  70. nonNative: ['1', '2', '3', '4']
  71. }
  72. const CLEAN_FILTER: Filters = {
  73. age: [],
  74. gender: [],
  75. ethnicity: [],
  76. nonNative: []
  77. };
  78. export default {
  79. AGE,
  80. NON_NATIVE,
  81. GENDER,
  82. ETHNICITY,
  83. FILTER,
  84. CLEAN_FILTER,
  85. FILTER_KEYS
  86. };