{ "version": 3, "sources": ["src/app/calendar/components/timeslot-partner-item/timeslot-partner-item.component.ts", "src/app/calendar/components/timeslot-partner-item/timeslot-partner-item.component.html"], "sourcesContent": ["import { CommonModule } from '@angular/common'\nimport { Component, Input, OnInit } from '@angular/core'\nimport { SafeResourceUrl } from '@angular/platform-browser'\nimport { RouterModule } from '@angular/router'\nimport { SessionActivityType } from '@app/core/_models'\nimport { AnalyticsService } from '@app/core/_services/analytics.service'\nimport { TimeUtilitiesService } from '@app/core/_services/time-utilities.service'\nimport { UserDateFormattingService } from '@app/core/_services/user-date-formatting.service'\nimport { UserService } from '@app/core/_services/user.service'\nimport { SharedModule } from '@app/shared/shared.module'\nimport { FontAwesomeModule } from '@fortawesome/angular-fontawesome'\nimport { faAddressCard } from '@fortawesome/pro-regular-svg-icons'\n\nconst NEW_USER = 'New!'\nconst ONE_MINUTE = 60000\n\n@Component({\n selector: 'app-timeslot-partner-item',\n imports: [CommonModule, SharedModule, RouterModule, FontAwesomeModule],\n templateUrl: './timeslot-partner-item.component.html',\n styleUrls: ['./timeslot-partner-item.component.scss'],\n})\nexport class TimeslotPartnerItemComponent implements OnInit {\n @Input() displayName: string | null = null\n @Input() saved: boolean = false\n @Input() profileImage: string | null = null\n @Input() profileUrl: string | null = null\n @Input() totalSessions: number = 0\n @Input() sharedSessions: number = 0\n @Input() lastSessionTogether: number | null = null\n @Input() timezone: string | null = null\n @Input() isCommunityMember: boolean = false\n @Input() snoozed: boolean = false\n @Input() snoozeTooltip: string | null = null\n @Input() selected: boolean = false\n @Input() currentUserTimezone: string = ''\n @Input() activityType: SessionActivityType | null = null\n @Input() quietMode: boolean = false\n\n public faAddressCard = faAddressCard\n public faGlobe\n public sessionsInfo: string\n public lastMet: string\n public timezoneAndTime: string\n public profileLink: SafeResourceUrl\n private timeoutId: any\n\n constructor(\n private analyticsService: AnalyticsService,\n private timeUtilitiesService: TimeUtilitiesService,\n public userService: UserService,\n private dateFormat: UserDateFormattingService,\n ) {}\n\n ngOnInit(): void {\n this.buildSessionInfo()\n this.buildLastMetInfo()\n this.buildProfileLink()\n this.buildTimeAndZoneInfo()\n this.determineGlobeIconToUser()\n }\n\n buildSessionInfo() {\n if (!this.totalSessions) {\n this.sessionsInfo = NEW_USER\n } else if (this.totalSessions === 1) {\n this.sessionsInfo = '1 session'\n } else {\n this.sessionsInfo = `${this.totalSessions} sessions`\n }\n if (this.sharedSessions && this.sharedSessions > 0) {\n this.sessionsInfo = `${this.sessionsInfo} · ${this.sharedSessions} together`\n }\n }\n\n buildLastMetInfo() {\n if (this.lastSessionTogether) {\n this.lastMet = this.dateFormat.generateLastMetString(this.lastSessionTogether)\n }\n }\n\n buildProfileLink() {\n if (this.profileUrl) {\n this.profileLink = `/user/${this.profileUrl}`\n }\n }\n\n buildTimeAndZoneInfo() {\n if (this.timezone) {\n this.timezoneAndTime = `${this.timezone} · ${this.dateFormat.formatNow('h:mma', this.timezone)}`\n }\n this.trackTime()\n }\n\n private trackTime() {\n let now = new Date()\n let delay = ONE_MINUTE - now.getSeconds() * 1000\n\n this.timeoutId = setTimeout(() => {\n if (this.timezone) {\n this.buildTimeAndZoneInfo()\n }\n }, delay)\n }\n\n private determineGlobeIconToUser() {\n // Show the cummonity globe if now user to show\n if (this.isCommunityMember) {\n this.profileImage = null\n this.faGlobe = this.timeUtilitiesService.determineGlobeIconFromTimezone(\n this.currentUserTimezone,\n )\n }\n }\n\n trackUserProfileSelected() {\n this.analyticsService.logClickedEvent('User', 'Timeslot Partners: List Item')\n }\n\n ngOnDestroy() {\n if (this.timeoutId) {\n clearTimeout(this.timeoutId)\n }\n }\n}\n", "