styling profile components

This commit is contained in:
Roland Osborne 2024-02-23 09:54:50 -08:00
parent 1cd729c820
commit ff66e8457d
13 changed files with 62 additions and 35 deletions

View File

@ -39,6 +39,7 @@ export const Colors = {
export const LightTheme = { export const LightTheme = {
baseArea: '#8fbea7', baseArea: '#8fbea7',
frameArea: '#dddddd',
iconArea: '#ffffff', iconArea: '#ffffff',
headerArea: '#f0f0f0', headerArea: '#f0f0f0',
footerArea: '#f0f0f0', footerArea: '#f0f0f0',
@ -67,6 +68,7 @@ export const LightTheme = {
export const DarkTheme = { export const DarkTheme = {
baseArea: '#080808', baseArea: '#080808',
frameArea: '#0a0a0a',
iconArea: '#ffffff', iconArea: '#ffffff',
headerArea: '#111111', headerArea: '#111111',
footerArea: '#111111', footerArea: '#111111',

View File

@ -8,6 +8,7 @@ export function useSettingsContext() {
display: null, display: null,
width: null, width: null,
height: null, height: null,
themes: [{ value: null, label: 'Default' }, { value: 'dark', label: 'Dark' }, { value: 'light', label: 'Light' }],
theme: null, theme: null,
setTheme: null, setTheme: null,
colors: {}, colors: {},

View File

@ -197,7 +197,7 @@ export function Session() {
</div> </div>
)} )}
{ state.profile && ( { state.profile && (
<div class="reframe"> <div class="reframe base">
<Profile closeProfile={actions.closeProfile} /> <Profile closeProfile={actions.closeProfile} />
</div> </div>
)} )}

View File

@ -182,6 +182,10 @@ export const SessionWrapper = styled.div`
.center { .center {
flex-grow: 1; flex-grow: 1;
position: relative; position: relative;
.base {
background-color: ${props => props.theme.frameArea};
}
} }
.right { .right {
min-width: 256px; min-width: 256px;

View File

@ -1,5 +1,5 @@
import { AccountWrapper } from './Account.styled'; import { AccountWrapper } from './Account.styled';
import { DoubleRightOutlined } from '@ant-design/icons'; import { RightOutlined } from '@ant-design/icons';
import { SettingOutlined } from '@ant-design/icons'; import { SettingOutlined } from '@ant-design/icons';
import { AccountAccess } from './profile/accountAccess/AccountAccess'; import { AccountAccess } from './profile/accountAccess/AccountAccess';
@ -10,7 +10,7 @@ export function Account({ closeAccount, openProfile }) {
<div className="header"> <div className="header">
<div className="label">Settings</div> <div className="label">Settings</div>
<div className="dismiss" onClick={closeAccount}> <div className="dismiss" onClick={closeAccount}>
<DoubleRightOutlined /> <RightOutlined />
</div> </div>
</div> </div>
<div className="content"> <div className="content">

View File

@ -6,7 +6,8 @@ export const AccountWrapper = styled.div`
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-color: ${props => props.theme.itemArea};; background-color: ${props => props.theme.selectedArea};
color: ${props => props.theme.mainText};
.header { .header {
width: 100%; width: 100%;

View File

@ -105,12 +105,14 @@ export function Profile({ closeProfile }) {
</div> </div>
)} )}
<div className={ state.display === 'xlarge' ? 'midContent' : 'rightContent' }> <div className={ state.display === 'xlarge' ? 'midContent' : 'rightContent' }>
{ state.urlSet && (
<div className="logo" onClick={actions.setEditProfileImage}> <div className="logo" onClick={actions.setEditProfileImage}>
<Logo url={state.url} width={'100%'} radius={4} /> <Logo url={state.url} width={'100%'} radius={4} />
<div className="edit"> <div className="edit">
<EditOutlined /> <EditOutlined />
</div> </div>
</div> </div>
)}
<div className="details"> <div className="details">
<div className="name" onClick={actions.setEditProfileDetails}> <div className="name" onClick={actions.setEditProfileDetails}>
{ state.name && ( { state.name && (
@ -143,8 +145,8 @@ export function Profile({ closeProfile }) {
</div> </div>
</div> </div>
</div> </div>
{ state.display !== 'xlarge' && ( { state.display !== 'xlarge' && state.displaySet && (
<div> <div className="rightAccess">
<AccountAccess /> <AccountAccess />
{ state.display === 'small' && ( { state.display === 'small' && (
<div className="logout" onClick={logout}> <div className="logout" onClick={logout}>
@ -152,6 +154,7 @@ export function Profile({ closeProfile }) {
<div className="label">Logout</div> <div className="label">Logout</div>
</div> </div>
)} )}
<div className="contentFill" />
</div> </div>
)} )}
<Modal title="Profile Image" centered visible={state.editProfileImage} footer={editImageFooter} <Modal title="Profile Image" centered visible={state.editProfileImage} footer={editImageFooter}

View File

@ -6,7 +6,6 @@ export const ProfileWrapper = styled.div`
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-color: ${props => props.theme.selectedArea};
color: ${props => props.theme.mainText}; color: ${props => props.theme.mainText};
.middleHeader { .middleHeader {
@ -40,6 +39,7 @@ export const ProfileWrapper = styled.div`
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
background-color: ${props => props.theme.selectedArea};
.title { .title {
font-size: 18px; font-size: 18px;
@ -61,8 +61,8 @@ export const ProfileWrapper = styled.div`
.logo { .logo {
position: relative; position: relative;
width: 256px; width: 192px;
height: 256px; height: 192px;
flex-shrink: 0; flex-shrink: 0;
cursor: pointer; cursor: pointer;
margin-left: 32px; margin-left: 32px;
@ -110,6 +110,18 @@ export const ProfileWrapper = styled.div`
align-items: center; align-items: center;
border-radius: 4px; border-radius: 4px;
padding: 8px; padding: 8px;
background-color: ${props => props.theme.selectedArea};
}
.rightAccess {
display: flex;
flex-direction: column;
flex-grow: 1;
.contentFill {
flex-grow: 1;
background-color: ${props => props.theme.selectedArea};
}
} }
.details { .details {
@ -196,9 +208,9 @@ export const ProfileWrapper = styled.div`
cursor: pointer; cursor: pointer;
color: ${props => props.theme.mainText}; color: ${props => props.theme.mainText};
background-color: ${props => props.theme.modalArea}; background-color: ${props => props.theme.modalArea};
margin-top: 8px;
padding: 8px; padding: 8px;
border-radius: 4px; border-radius: 4px;
justify-content: center;
.label { .label {
padding-left: 8px; padding-left: 8px;

View File

@ -85,15 +85,15 @@ export function AccountAccess() {
<div className="option"> <div className="option">
<div className="label">Time Format</div> <div className="label">Time Format</div>
<Radio.Group onChange={actions.setTimeFormat} value={state.timeFormat}> <Radio.Group onChange={actions.setTimeFormat} value={state.timeFormat}>
<Radio value={'12h'}>12h</Radio> <Radio style={state.menuStyle} value={'12h'}>12h</Radio>
<Radio value={'24h'}>24h</Radio> <Radio style={state.menuStyle} value={'24h'}>24h</Radio>
</Radio.Group> </Radio.Group>
</div> </div>
<div className="option"> <div className="option">
<div className="label">Date Format</div> <div className="label">Date Format</div>
<Radio.Group onChange={actions.setDateFormat} value={state.dateFormat}> <Radio.Group onChange={actions.setDateFormat} value={state.dateFormat}>
<Radio value={'mm/dd'}>mm/dd</Radio> <Radio style={state.menuStyle} value={'mm/dd'}>mm/dd</Radio>
<Radio value={'dd/mm'}>dd/mm</Radio> <Radio style={state.menuStyle} value={'dd/mm'}>dd/mm</Radio>
</Radio.Group> </Radio.Group>
</div> </div>
<div className="option"> <div className="option">
@ -103,11 +103,7 @@ export function AccountAccess() {
style={{ width: 128 }} style={{ width: 128 }}
value={state.theme} value={state.theme}
onChange={actions.setTheme} onChange={actions.setTheme}
options={[ options={state.themes}
{ value: null, label: 'Default' },
{ value: 'light', label: 'Light' },
{ value: 'dark', label: 'Dark' },
]}
/> />
</div> </div>
<div className="option"> <div className="option">

View File

@ -8,6 +8,8 @@ export const AccountAccessWrapper = styled.div`
justify-content: center; justify-content: center;
padding-bottom: 8px; padding-bottom: 8px;
width: 100%; width: 100%;
background-color: ${props => props.theme.selectedArea};
color: ${props => props.theme.mainText};
.account { .account {
width: 100%; width: 100%;
@ -32,6 +34,9 @@ export const AccountAccessWrapper = styled.div`
.label { .label {
padding-right: 16px; padding-right: 16px;
min-width: 110px; min-width: 110px;
height: 28px;
display: flex;
align-items: center;
} }
} }
} }
@ -52,6 +57,7 @@ export const AccountAccessWrapper = styled.div`
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
padding-bottom: 8px; padding-bottom: 8px;
padding-top: 8px;
.switchEnabled { .switchEnabled {
color: ${props => props.theme.activeArea}; color: ${props => props.theme.activeArea};
@ -95,6 +101,7 @@ export const SealModal = styled.div`
padding-bottom: 8px; padding-bottom: 8px;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding-top: 8px;
.switchLabel { .switchLabel {
color: ${props => props.theme.mainText}; color: ${props => props.theme.mainText};

View File

@ -26,9 +26,11 @@ export function useAccountAccess() {
sealDelete: null, sealDelete: null,
sealUnlock: null, sealUnlock: null,
menuStyle: {},
timeFormat: '12h', timeFormat: '12h',
dateFormat: 'mm/dd', dateFormat: 'mm/dd',
theme: null, theme: null,
themes: [],
language: null, language: null,
languages: [], languages: [],
@ -52,12 +54,12 @@ export function useAccountAccess() {
useEffect(() => { useEffect(() => {
const { seal, sealKey, status } = account.state; const { seal, sealKey, status } = account.state;
updateState({ searchable: status.searchable, seal, sealKey }); updateState({ searchable: status?.searchable, seal, sealKey });
}, [account.state]); }, [account.state]);
useEffect(() => { useEffect(() => {
const { timeFormat, dateFormat, theme, language, languages } = settings.state; const { menuStyle, timeFormat, dateFormat, theme, themes, language, languages } = settings.state;
updateState({ timeFormat, dateFormat, theme, language, languages }); updateState({ menuStyle, timeFormat, dateFormat, theme, themes, language, languages });
}, [settings.state]); }, [settings.state]);
const sealUnlock = async () => { const sealUnlock = async () => {
@ -99,8 +101,6 @@ export function useAccountAccess() {
const actions = { const actions = {
setTimeFormat: (timeFormat) => { setTimeFormat: (timeFormat) => {
console.log("TIME", timeFormat);
settings.actions.setTimeFormat(timeFormat.target.value); settings.actions.setTimeFormat(timeFormat.target.value);
}, },
setDateFormat: (dateFormat) => { setDateFormat: (dateFormat) => {

View File

@ -9,6 +9,10 @@ export function useProfile() {
const [state, setState] = useState({ const [state, setState] = useState({
handle: null, handle: null,
name: null, name: null,
url: null,
urlSet: false,
display: null,
displaySet: false,
location: null, location: null,
description: null, description: null,
editImage: null, editImage: null,
@ -23,7 +27,7 @@ export function useProfile() {
busy: false, busy: false,
}); });
const IMAGE_DIM = 256; const IMAGE_DIM = 192;
const app = useContext(AppContext); const app = useContext(AppContext);
const settings = useContext(SettingsContext); const settings = useContext(SettingsContext);
const profile = useContext(ProfileContext); const profile = useContext(ProfileContext);
@ -36,12 +40,12 @@ export function useProfile() {
const { node, name, handle, location, description, image } = profile.state.identity; const { node, name, handle, location, description, image } = profile.state.identity;
let url = !image ? null : profile.state.imageUrl; let url = !image ? null : profile.state.imageUrl;
let editImage = !image ? avatar : url; let editImage = !image ? avatar : url;
updateState({ name, location, description, node, handle, url, updateState({ name, location, description, node, handle, url, urlSet: true,
editName: name, editLocation: location, editDescription: description, editHandle: handle, editImage }); editName: name, editLocation: location, editDescription: description, editHandle: handle, editImage });
}, [profile.state]); }, [profile.state]);
useEffect(() => { useEffect(() => {
updateState({ display: settings.state.display }); updateState({ displaySet: true, display: settings.state.display });
}, [settings.state]); }, [settings.state]);
const actions = { const actions = {

View File

@ -98,9 +98,6 @@ export function useSession() {
useEffect(() => { useEffect(() => {
const { display, theme } = settings.state; const { display, theme } = settings.state;
updateState({ display, theme }); updateState({ display, theme });
console.log("SET THEME: ", theme);
}, [settings.state]); }, [settings.state]);
useEffect(() => { useEffect(() => {