<commit_before>import * as React from 'react';
import {getRecentMeetings, IGetRecentMeetings} from '../../apollo/modules/meetings';
import {allOutcomeSets,IOutcomeResult} from 'apollo/modules/outcomeSets';
import {Message} from 'semantic-ui-react';

interface IProps {
  meetings?: IGetRecentMeetings;
  data?: IOutcomeResult;
}

const inner = (p: IProps) => {
  const loading = p.data.loading || p.meetings.loading;
  if (loading) {
    return (<div />);
  }
  const hasOneQuestionnaire = p.data.allOutcomeSets &&
    p.data.allOutcomeSets.length === 1;
  const hasNoRecords = p.meetings.getRecentMeetings &&
    p.meetings.getRecentMeetings.meetings &&
    p.meetings.getRecentMeetings.meetings.length === 0;
  if (!hasOneQuestionnaire || !hasNoRecords) {
    return (<div />);
  }
  return (
    <Message info={true} className="new-record-signpost">
      <Message.Header>What next?</Message.Header>
      <p>Collect answers from your beneficiaries, these are stored as records in the system.</p>
      <p>Press the plus button in the header to get started.</p>
    </Message>
  );
};

const Component = (p: IProps) => {
  // this is best effort
  try {
    return inner(p);
  } catch {
    return (<div />);
  }
};

export const OnboardingNewRecordHint = allOutcomeSets(getRecentMeetings(() => 0, 'meetings')(Component));
<commit_msg>#510 showing what next message even if the user adds more than one questionnaire<commit_after>import * as React from 'react';
import {getRecentMeetings, IGetRecentMeetings} from '../../apollo/modules/meetings';
import {allOutcomeSets,IOutcomeResult} from 'apollo/modules/outcomeSets';
import {Message} from 'semantic-ui-react';

interface IProps {
  meetings?: IGetRecentMeetings;
  data?: IOutcomeResult;
}

const inner = (p: IProps) => {
  const loading = p.data.loading || p.meetings.loading;
  if (loading) {
    return (<div />);
  }
  const hasAtleastOneQuestionniare = p.data.allOutcomeSets &&
    p.data.allOutcomeSets.length >= 1;
  const hasNoRecords = p.meetings.getRecentMeetings &&
    p.meetings.getRecentMeetings.meetings &&
    p.meetings.getRecentMeetings.meetings.length === 0;
  const shouldShow = hasNoRecords && hasAtleastOneQuestionniare;
  if (!shouldShow) {
    return (<div />);
  }
  return (
    <Message info={true} className="new-record-signpost">
      <Message.Header>What next?</Message.Header>
      <p>Collect answers from your beneficiaries, these are stored as records in the system.</p>
      <p>Press the plus button in the header to get started.</p>
    </Message>
  );
};

const Component = (p: IProps) => {
  // this is best effort
  try {
    return inner(p);
  } catch {
    return (<div />);
  }
};

export const OnboardingNewRecordHint = allOutcomeSets(getRecentMeetings(() => 0, 'meetings')(Component));

{'fraction_non_alphanumeric': 0.1373744619799139, 'fraction_numerical': 0.0032281205164992827, 'mean_word_length': 3.9450354609929077, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5102608', 'n_tokens_mistral': 948, 'n_tokens_neox': 884, 'n_words': 220}