diff --git a/web/settings/account-settings.react.js b/web/settings/account-settings.react.js index b694b1b7d..cbaa48529 100644 --- a/web/settings/account-settings.react.js +++ b/web/settings/account-settings.react.js @@ -1,140 +1,142 @@ // @flow import * as React from 'react'; import { logOut, logOutActionTypes } from 'lib/actions/user-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { useStringForUser } from 'lib/hooks/ens-cache.js'; import { preRequestUserStateSelector } from 'lib/selectors/account-selectors.js'; import { accountHasPassword } from 'lib/shared/account-utils.js'; import { useDispatchActionPromise, useServerCall, } from 'lib/utils/action-utils.js'; import css from './account-settings.css'; +import AppearanceChangeModal from './appearance-change-modal.react.js'; import PasswordChangeModal from './password-change-modal.js'; import BlockListModal from './relationship/block-list-modal.react.js'; import FriendListModal from './relationship/friend-list-modal.react.js'; import EditUserAvatar from '../avatars/edit-user-avatar.react.js'; import Button from '../components/button.react.js'; import { useSelector } from '../redux/redux-utils.js'; import { useStaffCanSee } from '../utils/staff-utils.js'; function AccountSettings(): React.Node { const sendLogoutRequest = useServerCall(logOut); const preRequestUserState = useSelector(preRequestUserStateSelector); const dispatchActionPromise = useDispatchActionPromise(); const logOutUser = React.useCallback( () => dispatchActionPromise( logOutActionTypes, sendLogoutRequest(preRequestUserState), ), [dispatchActionPromise, preRequestUserState, sendLogoutRequest], ); const { pushModal, popModal } = useModalContext(); const showPasswordChangeModal = React.useCallback( () => pushModal(), [pushModal], ); const openFriendList = React.useCallback( () => pushModal(), [popModal, pushModal], ); const openBlockList = React.useCallback( () => pushModal(), [popModal, pushModal], ); const isAccountWithPassword = useSelector(state => accountHasPassword(state.currentUserInfo), ); const currentUserInfo = useSelector(state => state.currentUserInfo); const stringForUser = useStringForUser(currentUserInfo); const staffCanSee = useStaffCanSee(); - const showAppearanceModal = React.useCallback(() => { - // TODO - }, []); + const showAppearanceModal = React.useCallback( + () => pushModal(), + [pushModal], + ); if (!currentUserInfo || currentUserInfo.anonymous) { return null; } let changePasswordSection; if (isAccountWithPassword) { changePasswordSection = (
  • Password ******
  • ); } let preferences; if (staffCanSee) { preferences = (

    Preferences

    • Appearance
    ); } return (

    My Account

    • {'Logged in as '} {stringForUser}

    • {changePasswordSection}
    • Friend List
    • Block List
    {preferences}
    ); } export default AccountSettings; diff --git a/web/settings/appearance-change-modal.css b/web/settings/appearance-change-modal.css new file mode 100644 index 000000000..acb4cb164 --- /dev/null +++ b/web/settings/appearance-change-modal.css @@ -0,0 +1,27 @@ +.container { + padding: 16px 32px 24px; +} + +.header { + font-size: var(--l-font-18); + color: var(--fg); + font-weight: var(--normal); +} + +.buttonContainer { + display: flex; + justify-content: space-between; + margin-top: 24px; +} + +.button { + color: var(--fg); +} + +.button:hover { + cursor: pointer; +} + +.selectedButton { + border-bottom: 1px solid var(--fg); +} diff --git a/web/settings/appearance-change-modal.react.js b/web/settings/appearance-change-modal.react.js new file mode 100644 index 000000000..61a049a35 --- /dev/null +++ b/web/settings/appearance-change-modal.react.js @@ -0,0 +1,59 @@ +// @flow + +import classNames from 'classnames'; +import * as React from 'react'; + +import { useModalContext } from 'lib/components/modal-provider.react.js'; + +import css from './appearance-change-modal.css'; +import Modal from '../modals/modal.react.js'; + +function AppearanceChangeModal(): React.Node { + const { popModal } = useModalContext(); + + const [selectedMode, setSelectedMode] = React.useState('dark'); + + const onClickLightModeButton = React.useCallback( + () => setSelectedMode('light'), + [], + ); + + const onClickDarkModeButton = React.useCallback( + () => setSelectedMode('dark'), + [], + ); + + const lightModeButtonClassName = classNames({ + [css.button]: true, + [css.selectedButton]: selectedMode === 'light', + }); + + const darkModeButtonClassName = classNames({ + [css.button]: true, + [css.selectedButton]: selectedMode === 'dark', + }); + + return ( + +
    +

    App theme

    +
    +
    + Light +
    +
    + Dark +
    +
    +
    +
    + ); +} + +export default AppearanceChangeModal;