Home Reference Source

src/objects/Help.js

/**
 * Object containing information dispayed as help.
 * The helper is only displayed using this object. In case the helper is used as
 * image without help-function, isInteractive is set to false.
 * helperId is the id of the lionAvatar object.
 * @type {Object[]}
 */
const help = [
    {
        id: 0,
        isInteractive: true,
        description: 'Help landing view',
        text: 'Velkommen til aktivitetssiden! Her skal du si hva du synes om de aktivitetene som du har vært med på så langt. Over oss ser du bilder av disse aktivitetene. Prøv å trykke på et av bildene, da!',
        speech: 'landingsside_dialog',
        helperId: 1,
        styling: {
            smallSpace: false,
        },
    },
    {
        id: 1,
        isInteractive: true,
        description: 'Help assessments',
        text: 'Her er aktiviteten din! Jeg vil gjerne høre hvordan denne aktiviteten gikk for deg. Til høyre kan du velge hvordan du vil fortelle meg hvordan det gikk. Du kan gi smilefjes, skrive og tegne!',
        speech: 'aktivitet_dialog',
        helperId: 0,
        styling: {
            smallSpace: false,
        },
    },
    {
        id: 2,
        isInteractive: true,
        description: 'Help smileyometer',
        text: 'Her får du ulike spørsmål om aktiviteten! Les spørsmålet og trykk på smilefjeset som passer best. Etterpå kan du gå videre til neste spørsmål, eller tilbake til forrige spørsmål.',
        speech: 'smilefjesmodul_dialog',
        helperId: 3,
        styling: {
            smallSpace: false,
        },
    },
    {
        id: 3,
        isInteractive: true,
        description: 'Help free text module',
        text: `Her kan du skrive hva du synes om aktiviteten, og i menyen til høyre kan du endre på farger og tekst.`,
        speech: 'fritekstmodul_dialog',
        helperId: 4,
        styling: {
            smallSpace: true,
        },
    },
    {
        id: 4,
        isInteractive: true,
        description: 'Help drawing module',
        text: 'Her kan du tegne for å fortelle mer om hvordan du syntes aktiviteten var!',
        speech: 'illustrasjonsmodul_dialog',
        helperId: 4,
        styling: {
            smallSpace: true,
            lowHeight: false,
        },
    },
    {
        id: 5,
        isInteractive: true,
        description: 'Help diary',
        text: 'Her er dagboken din. Du kan bla i den og se hva du har svart på tidligere aktiviteter!',
        speech: null,
        helperId: 5,
        styling: {
            smallSpace: true,
        },
    },
    {
        id: 6,
        isInteractive: false,
        description: 'Confirmation assessment',
        text: null,
        speech: null,
        helperId: 6,
        styling: {
            smallSpace: false,
        },
    },
    {
        id: 7,
        isInteractive: false,
        description: 'Alert',
        text: null,
        speech: null,
        helperId: 7,
        styling: {
            smallSpace: false,
        },
    },
    {
        id: 8,
        isInteractive: false,
        description: 'Confirmation',
        text: null,
        speech: null,
        helperId: 8,
        styling: {
            smallSpace: false,
        },
    },
];

/**
 * Return help object with given id
 * @param {number} id - id of help object
 * @returns {Object} help object
 */
function findHelpWithId(id) {
    return help.find(h => h.id === id);
}

/**
 * Return properties of the help object with the given id
 * @param {number} id - id of help object
 * @returns {Object[]} help object with extracted information
 */
function initHelp(id) {
    const h = findHelpWithId(id);

    if (h !== undefined) {
        const isInteractive = h.isInteractive;
        const text = h.text;
        const sound = h.speech;
        const styling = h.styling;

        return [h, isInteractive, text, sound, styling];
    } else return null;
}
export {initHelp};