function computeVariant()

in packages/storybook8/stories/Concepts/TeamsInterop/ComplianceBanner/snippets/ComplianceBanner.snippet.tsx [86:134]


function computeVariant(
  previousCallRecordState: boolean | undefined,
  previousCallTranscribeState: boolean | undefined,
  callRecordState: boolean | undefined,
  callTranscribeState: boolean | undefined
): number {
  if (previousCallRecordState && previousCallTranscribeState) {
    if (callRecordState && !callTranscribeState) {
      return TRANSCRIPTION_STOPPED_STILL_RECORDING;
    } else if (!callRecordState && callTranscribeState) {
      return RECORDING_STOPPED_STILL_TRANSCRIBING;
    } else if (!callRecordState && !callTranscribeState) {
      return RECORDING_AND_TRANSCRIPTION_STOPPED;
    } else {
      return NO_STATE;
    }
  } else if (previousCallRecordState && !previousCallTranscribeState) {
    if (callRecordState && callTranscribeState) {
      return RECORDING_AND_TRANSCRIPTION_STARTED;
    } else if (!callRecordState && callTranscribeState) {
      return TRANSCRIPTION_STARTED;
    } else if (!callRecordState && !callTranscribeState) {
      return RECORDING_STOPPED;
    } else {
      return NO_STATE;
    }
  } else if (!previousCallRecordState && previousCallTranscribeState) {
    if (callRecordState && callTranscribeState) {
      return RECORDING_AND_TRANSCRIPTION_STARTED;
    } else if (!callRecordState && callTranscribeState) {
      return RECORDING_STARTED;
    } else if (!callRecordState && !callTranscribeState) {
      return TRANSCRIPTION_STOPPED;
    } else {
      return NO_STATE;
    }
  } else if (!previousCallRecordState && !previousCallTranscribeState) {
    if (callRecordState && callTranscribeState) {
      return RECORDING_AND_TRANSCRIPTION_STARTED;
    } else if (callRecordState && !callTranscribeState) {
      return RECORDING_STARTED;
    } else if (!callRecordState && callTranscribeState) {
      return TRANSCRIPTION_STARTED;
    } else {
      return NO_STATE;
    }
  }
  return NO_STATE;
}