All files / app/features/profile constants.ts

85.71% Statements 24/28
0% Branches 0/4
77.77% Functions 7/9
83.33% Lines 10/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69  10x 10x   26x             32x           29x                 32x               17x               10x             29x             25x                        
import { TFunction } from "i18next";
import { HostingStatus, MeetupStatus, ParkingDetails, SleepingArrangement, SmokingLocation } from "proto/api_pb";
import { ReferenceType } from "proto/references_pb";
 
export const referencesFilterLabels = (t: TFunction) => ({
  [ReferenceType.REFERENCE_TYPE_FRIEND]: t("profile:reference_filter_label.friend"),
  [ReferenceType.REFERENCE_TYPE_HOSTED]: t("profile:reference_filter_label.hosted"),
  [ReferenceType.REFERENCE_TYPE_SURFED]: t("profile:reference_filter_label.surfed"),
  all: t("profile:reference_filter_label.all"),
  given: t("profile:reference_filter_label.given"),
});
export const referenceBadgeLabel = (t: TFunction) => ({
  [ReferenceType.REFERENCE_TYPE_FRIEND]: t("profile:reference_badge_label.friend"),
  [ReferenceType.REFERENCE_TYPE_HOSTED]: t("profile:reference_badge_label.hosted"),
  [ReferenceType.REFERENCE_TYPE_SURFED]: t("profile:reference_badge_label.surfed"),
});
 
export const smokingLocationLabels = (t: TFunction): Record<number, string> => ({
  [SmokingLocation.SMOKING_LOCATION_NO]: t("profile:smoking_location.no"),
  [SmokingLocation.SMOKING_LOCATION_OUTSIDE]: t("profile:smoking_location.outside"),
  [SmokingLocation.SMOKING_LOCATION_WINDOW]: t("profile:smoking_location.window"),
  [SmokingLocation.SMOKING_LOCATION_YES]: t("profile:smoking_location.yes"),
  [SmokingLocation.SMOKING_LOCATION_UNKNOWN]: t("profile:unspecified_info"),
  [SmokingLocation.SMOKING_LOCATION_UNSPECIFIED]: t("profile:unspecified_info"),
});
 
export const hostingStatusLabels = (t: TFunction) => ({
  [HostingStatus.HOSTING_STATUS_CAN_HOST]: t("global:hosting_status.can_host"),
  [HostingStatus.HOSTING_STATUS_MAYBE]: t("global:hosting_status.maybe"),
  [HostingStatus.HOSTING_STATUS_CANT_HOST]: t("global:hosting_status.cant_host"),
  [HostingStatus.HOSTING_STATUS_UNSPECIFIED]: t("global:hosting_status.unspecified_info"),
  [HostingStatus.HOSTING_STATUS_UNKNOWN]: t("global:hosting_status.unspecified_info"),
});
 
export const meetupStatusLabels = (t: TFunction) => ({
  [MeetupStatus.MEETUP_STATUS_WANTS_TO_MEETUP]: t("global:meetup_status.wants_to_meetup"),
  [MeetupStatus.MEETUP_STATUS_OPEN_TO_MEETUP]: t("global:meetup_status.open_to_meetup"),
  [MeetupStatus.MEETUP_STATUS_DOES_NOT_WANT_TO_MEETUP]: t("global:meetup_status.does_not_want_to_meetup"),
  [MeetupStatus.MEETUP_STATUS_UNSPECIFIED]: t("global:meetup_status.unspecified_info"),
  [MeetupStatus.MEETUP_STATUS_UNKNOWN]: t("global:meetup_status.unspecified_info"),
});
 
export const sleepingArrangementLabels = (t: TFunction): Record<number, string> => ({
  [SleepingArrangement.SLEEPING_ARRANGEMENT_PRIVATE]: t("profile:sleeping_arrangement.private"),
  [SleepingArrangement.SLEEPING_ARRANGEMENT_COMMON]: t("profile:sleeping_arrangement.common"),
  [SleepingArrangement.SLEEPING_ARRANGEMENT_SHARED_ROOM]: t("profile:sleeping_arrangement.shared_room"),
  [SleepingArrangement.SLEEPING_ARRANGEMENT_UNKNOWN]: t("profile:unspecified_info"),
});
 
export const sleepingArrangementLabelsShort = (t: TFunction): Record<number, string> => ({
  [SleepingArrangement.SLEEPING_ARRANGEMENT_PRIVATE]: t("profile:sleeping_arrangement.private_short"),
  [SleepingArrangement.SLEEPING_ARRANGEMENT_COMMON]: t("profile:sleeping_arrangement.common_short"),
  [SleepingArrangement.SLEEPING_ARRANGEMENT_SHARED_ROOM]: t("profile:sleeping_arrangement.shared_room_short"),
  [SleepingArrangement.SLEEPING_ARRANGEMENT_UNKNOWN]: t("profile:unspecified_info"),
});
 
export const parkingDetailsLabels = (t: TFunction): Record<number, string> => ({
  [ParkingDetails.PARKING_DETAILS_FREE_ONSITE]: t("profile:parking_details.free_onsite"),
  [ParkingDetails.PARKING_DETAILS_FREE_OFFSITE]: t("profile:parking_details.free_offsite"),
  [ParkingDetails.PARKING_DETAILS_PAID_ONSITE]: t("profile:parking_details.paid_onsite"),
  [ParkingDetails.PARKING_DETAILS_PAID_OFFSITE]: t("profile:parking_details.paid_offsite"),
  [ParkingDetails.PARKING_DETAILS_UNSPECIFIED]: t("profile:unspecified_info"),
  [ParkingDetails.PARKING_DETAILS_UNKNOWN]: t("profile:unspecified_info"),
});
 
export function booleanConversion(t: TFunction, value: boolean | undefined) {
  return value === undefined ? t("profile:info_unanswered") : value ? t("global:yes") : t("global:no");
}