# Code coverage report for atlas-mobile-ts/src/components/Profile/ProfileSections.tsx

# All files / atlas-mobile-ts/src/components/Profile ProfileSections.tsx

0% Statements 0/68
0% Branches 0/20
0% Functions 0/7
0% Lines 0/47

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

     ﻿/* Copyright (C) Click & Push Accessibility, Inc - All Rights Reserved
     * Unauthorized copying of this file, via any medium is strictly prohibited
     * Proprietary and confidential
     * Written and maintained by the Click & Push Development team
     * <dev@clicknpush.ca>, January 2022
     */

    import React, { useState } from "react"
    import { View } from "react-native"
    import { Landmark } from "../../hooks/useLandmarks"
    import { UserProfile } from "../../hooks/useProfile"
    import { RegisterCredsValues } from "../../utils/RegistrationUtils"
    import { ProfileInformation } from "./ProfileSections/ProfileInformation"
    import { ProfileLegal } from "./ProfileSections/ProfileLegal"
    import { ProfilePrefs } from "./ProfileSections/ProfilePrefs"
    import { ProfileSkills } from "./ProfileSections/ProfileSkills"
    import { ProfileSubscription } from "./ProfileSections/ProfileSubscription"
    import * as Linking from 'expo-linking'
    import { ProfileSection } from "./ProfileSections/ProfileSection"
    import { ProfileSectionHeader } from "./ProfileSections/ProfileSectionHeader"

    interface ProfileSectionsProps {
        profile: UserProfile,
        toggleTipsAsync: () => void,
        changePassword: (password: string) => void,
        changePasswordStatus: string,
        resetChangePassword: () => void
        changeInfo: (info: RegisterCredsValues) => void
        changeInfoStatus: string
        resetChangeInfo: () => void
        deleteAccount: () => void
        deleteAccountStatus: string
    }

    export const ProfileSections: React.FC<ProfileSectionsProps> = ({
        profile,
        toggleTipsAsync,
        changePassword,
        changePasswordStatus,
        resetChangePassword,
        changeInfo,
        changeInfoStatus,
        resetChangeInfo,
        deleteAccount,
        deleteAccountStatus
    }) => {
        const [infoCollapsed, toggleInfo] = useState<boolean>(true)
        const [skillsCollapsed, toggleSkills] = useState<boolean>(true)
        const [prefsCollapsed, togglePrefs] = useState<boolean>(true)
        const [subscriptionCollapsed, toggleSubscription] = useState<boolean>(true)
        const [legalCollapsed, toggleLegal] = useState<boolean>(true)

        const openInfo = () => {
            toggleInfo(!infoCollapsed)
            Iif (!skillsCollapsed) toggleSkills(true)
            Iif (!prefsCollapsed) togglePrefs(true)
            Iif (!subscriptionCollapsed) toggleSubscription(!subscriptionCollapsed)
            Iif (!legalCollapsed) toggleLegal(true)
        }

        const openSkills = () => {
            toggleSkills(!skillsCollapsed)
            Iif (!infoCollapsed) toggleInfo(true)
            Iif (!prefsCollapsed) togglePrefs(true)
            Iif (!subscriptionCollapsed) toggleSubscription(!subscriptionCollapsed)
            Iif (!legalCollapsed) toggleLegal(true)
        }

        const openPrefs = () => {
            togglePrefs(!prefsCollapsed)
            Iif (!infoCollapsed) toggleInfo(true)
            Iif (!skillsCollapsed) toggleSkills(true)
            Iif (!subscriptionCollapsed) toggleSubscription(!subscriptionCollapsed)
            Iif (!legalCollapsed) toggleLegal(true)
        }

        const openSubscription = () => {
            toggleSubscription(!subscriptionCollapsed)
            Iif (!infoCollapsed) toggleInfo(true)
            Iif (!skillsCollapsed) toggleSkills(true)
            Iif (!prefsCollapsed) togglePrefs(true)
            Iif (!legalCollapsed) toggleLegal(true)
        }

        const openLegal = () => {
            toggleLegal(!legalCollapsed)
            Iif (!infoCollapsed) toggleInfo(true)
            Iif (!subscriptionCollapsed) toggleSubscription(true)
            Iif (!skillsCollapsed) toggleSkills(true)
            Iif (!prefsCollapsed) togglePrefs(true)
        }

        const openFeedback = () => {
            Linking.openURL('mailto:dev@clicknpush.ca')
        }

        return (
            <View>
                <ProfileInformation
                    changeInfo={changeInfo}
                    changeInfoStatus={changeInfoStatus}
                    deleteAccount={deleteAccount}
                    deleteAccountStatus={deleteAccountStatus}
                    resetChangeInfo={resetChangeInfo}
                    resetChangePassword={resetChangePassword}
                    changePasswordStatus={changePasswordStatus}
                    changePassword={changePassword}
                    openInfo={openInfo}
                    infoCollapsed={infoCollapsed}
                    email={profile?.email}
                    username={profile?.username} />
                {/* <ProfileSkills openSkills={openSkills} skillsCollapsed={skillsCollapsed} /> */}
                <ProfilePrefs openPrefs={openPrefs} showTips={profile?.show_tips} prefsCollapsed={prefsCollapsed} toggleTipsAsync={toggleTipsAsync} />
                <ProfileSubscription openSubscription={openSubscription} subscriptionCollapsed={subscriptionCollapsed} />
                <ProfileLegal openLegal={openLegal} legalCollapsed={legalCollapsed} />
                <ProfileSectionHeader isCollapsed={true} collapseToggleMethod={openFeedback} title="Provide feedback"/>
            </View>
        )
    }