All files / app/features/profile constants.ts

97.05% Statements 33/34
0% Branches 0/4
88.88% Functions 8/9
93.75% Lines 15/16

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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137              11x 11x   11x 11x 11x 11x   19x           26x                         43x                       25x                         30x                           20x                                   25x                                         25x                                 11x              
import { TFunction } from "i18n";
import {
  HostingStatus,
  MeetupStatus,
  ParkingDetails,
  SleepingArrangement,
  SmokingLocation,
} from "proto/api_pb";
import { ReferenceType } from "proto/references_pb";
 
export const referencesQueryStaleTime = 10 * 60 * 1000;
export const contactLink = "mailto:support@couchers.org";
export const hostRequestReferenceSuccessDialogId =
  "hostRequestReferneceSuccessDialog";
 
export const sectionLabels = (t: TFunction) => ({
  about: t("profile:heading.about_me"),
  home: t("profile:heading.home"),
  references: t("profile:heading.references"),
});
 
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) => ({
  [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) => ({
  [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_SHARED_SPACE]: t(
    "profile:sleeping_arrangement.shared_space"
  ),
  [SleepingArrangement.SLEEPING_ARRANGEMENT_UNSPECIFIED]: t(
    "profile:unspecified_info"
  ),
  [SleepingArrangement.SLEEPING_ARRANGEMENT_UNKNOWN]: t(
    "profile:unspecified_info"
  ),
});
 
export const parkingDetailsLabels = (t: TFunction) => ({
  [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");
}