Apply theme to app pages

This commit is contained in:
Nicola Benaglia 2025-04-20 19:33:38 +02:00
parent e8ccfb3d46
commit 8d20f1a6db
7 changed files with 88 additions and 53 deletions

View File

@ -7,7 +7,6 @@ import {
AppInfoSnippetContainer, AppInfoSnippetContainer,
AppInfoSnippetLeft, AppInfoSnippetLeft,
AppInfoSnippetMiddle, AppInfoSnippetMiddle,
AppInfoSnippetRight,
AppInfoUserName, AppInfoUserName,
AppsCategoryInfo, AppsCategoryInfo,
AppsCategoryInfoLabel, AppsCategoryInfoLabel,
@ -17,7 +16,7 @@ import {
AppsLibraryContainer, AppsLibraryContainer,
AppsWidthLimiter, AppsWidthLimiter,
} from './Apps-styles'; } from './Apps-styles';
import { Avatar, Box } from '@mui/material'; import { Avatar, Box, useTheme } from '@mui/material';
import { getBaseApiReact } from '../../App'; import { getBaseApiReact } from '../../App';
import LogoSelected from '../../assets/svgs/LogoSelected.svg'; import LogoSelected from '../../assets/svgs/LogoSelected.svg';
import { Spacer } from '../../common/Spacer'; import { Spacer } from '../../common/Spacer';
@ -35,6 +34,7 @@ export const AppInfo = ({ app, myName }) => {
const [sortablePinnedApps, setSortablePinnedApps] = useRecoilState( const [sortablePinnedApps, setSortablePinnedApps] = useRecoilState(
sortablePinnedAppsAtom sortablePinnedAppsAtom
); );
const theme = useTheme();
const isSelectedAppPinned = !!sortablePinnedApps?.find( const isSelectedAppPinned = !!sortablePinnedApps?.find(
(item) => item?.name === app?.name && item?.service === app?.service (item) => item?.name === app?.name && item?.service === app?.service
@ -104,17 +104,21 @@ export const AppInfo = ({ app, myName }) => {
</Avatar> </Avatar>
</AppCircle> </AppCircle>
</AppCircleContainer> </AppCircleContainer>
<AppInfoSnippetMiddle> <AppInfoSnippetMiddle>
<AppInfoAppName> <AppInfoAppName>
{app?.metadata?.title || app?.name} {app?.metadata?.title || app?.name}
</AppInfoAppName> </AppInfoAppName>
<Spacer height="6px" /> <Spacer height="6px" />
<AppInfoUserName>{app?.name}</AppInfoUserName> <AppInfoUserName>{app?.name}</AppInfoUserName>
<Spacer height="3px" /> <Spacer height="3px" />
</AppInfoSnippetMiddle> </AppInfoSnippetMiddle>
</AppInfoSnippetLeft> </AppInfoSnippetLeft>
<AppInfoSnippetRight></AppInfoSnippetRight>
</AppInfoSnippetContainer> </AppInfoSnippetContainer>
<Spacer height="11px" /> <Spacer height="11px" />
<Box <Box
sx={{ sx={{
@ -159,11 +163,11 @@ export const AppInfo = ({ app, myName }) => {
setSettingsLocalLastUpdated(Date.now()); setSettingsLocalLastUpdated(Date.now());
}} }}
sx={{ sx={{
backgroundColor: '#359ff7ff', backgroundColor: theme.palette.background.paper,
width: '100%',
maxWidth: '320px',
height: '29px', height: '29px',
maxWidth: '320px',
opacity: isSelectedAppPinned ? 0.6 : 1, opacity: isSelectedAppPinned ? 0.6 : 1,
width: '100%',
}} }}
> >
<AppDownloadButtonText> <AppDownloadButtonText>
@ -172,6 +176,7 @@ export const AppInfo = ({ app, myName }) => {
: 'Pin to dashboard'} : 'Pin to dashboard'}
</AppDownloadButtonText> </AppDownloadButtonText>
</AppDownloadButton> </AppDownloadButton>
<AppDownloadButton <AppDownloadButton
onClick={() => { onClick={() => {
executeEvent('addTab', { executeEvent('addTab', {
@ -179,10 +184,12 @@ export const AppInfo = ({ app, myName }) => {
}); });
}} }}
sx={{ sx={{
backgroundColor: isInstalled ? '#0091E1' : '#247C0E', backgroundColor: isInstalled
width: '100%', ? '#0091E1'
maxWidth: '320px', : theme.palette.background.paper,
height: '29px', height: '29px',
maxWidth: '320px',
width: '100%',
}} }}
> >
<AppDownloadButtonText> <AppDownloadButtonText>
@ -191,25 +198,41 @@ export const AppInfo = ({ app, myName }) => {
</AppDownloadButton> </AppDownloadButton>
</Box> </Box>
</AppsWidthLimiter> </AppsWidthLimiter>
<Spacer height="20px" /> <Spacer height="20px" />
<AppsWidthLimiter> <AppsWidthLimiter>
<AppsCategoryInfo> <AppsCategoryInfo>
<AppRating ratingCountPosition="top" myName={myName} app={app} /> <AppRating ratingCountPosition="top" myName={myName} app={app} />
<Spacer width="16px" /> <Spacer width="16px" />
<Spacer height="40px" width="1px" backgroundColor="white" />
<Spacer
backgroundColor={theme.palette.background.paper}
height="40px"
width="1px"
/>
<Spacer width="16px" /> <Spacer width="16px" />
<AppsCategoryInfoSub> <AppsCategoryInfoSub>
<AppsCategoryInfoLabel>Category:</AppsCategoryInfoLabel> <AppsCategoryInfoLabel>Category:</AppsCategoryInfoLabel>
<Spacer height="4px" /> <Spacer height="4px" />
<AppsCategoryInfoValue> <AppsCategoryInfoValue>
{app?.metadata?.categoryName || 'none'} {app?.metadata?.categoryName || 'none'}
</AppsCategoryInfoValue> </AppsCategoryInfoValue>
</AppsCategoryInfoSub> </AppsCategoryInfoSub>
</AppsCategoryInfo> </AppsCategoryInfo>
<Spacer height="30px" /> <Spacer height="30px" />
<AppInfoAppName>About this Q-App</AppInfoAppName> <AppInfoAppName>About this Q-App</AppInfoAppName>
</AppsWidthLimiter> </AppsWidthLimiter>
<Spacer height="20px" /> <Spacer height="20px" />
<AppsInfoDescription> <AppsInfoDescription>
{app?.metadata?.description || 'No description'} {app?.metadata?.description || 'No description'}
</AppsInfoDescription> </AppsInfoDescription>

View File

@ -1,4 +1,3 @@
import React from 'react';
import { import {
AppCircle, AppCircle,
AppCircleContainer, AppCircleContainer,
@ -11,7 +10,7 @@ import {
AppInfoSnippetRight, AppInfoSnippetRight,
AppInfoUserName, AppInfoUserName,
} from './Apps-styles'; } from './Apps-styles';
import { Avatar, ButtonBase } from '@mui/material'; import { Avatar, ButtonBase, useTheme } from '@mui/material';
import { getBaseApiReact } from '../../App'; import { getBaseApiReact } from '../../App';
import LogoSelected from '../../assets/svgs/LogoSelected.svg'; import LogoSelected from '../../assets/svgs/LogoSelected.svg';
import { Spacer } from '../../common/Spacer'; import { Spacer } from '../../common/Spacer';
@ -41,6 +40,8 @@ export const AppInfoSnippet = ({
const setSettingsLocalLastUpdated = useSetRecoilState( const setSettingsLocalLastUpdated = useSetRecoilState(
settingsLocalLastUpdatedAtom settingsLocalLastUpdatedAtom
); );
const theme = useTheme();
return ( return (
<AppInfoSnippetContainer <AppInfoSnippetContainer
sx={{ sx={{
@ -96,6 +97,7 @@ export const AppInfoSnippet = ({
</AppCircle> </AppCircle>
</AppCircleContainer> </AppCircleContainer>
</ButtonBase> </ButtonBase>
<AppInfoSnippetMiddle> <AppInfoSnippetMiddle>
<ButtonBase <ButtonBase
onClick={() => { onClick={() => {
@ -112,12 +114,17 @@ export const AppInfoSnippet = ({
> >
<AppInfoAppName>{app?.metadata?.title || app?.name}</AppInfoAppName> <AppInfoAppName>{app?.metadata?.title || app?.name}</AppInfoAppName>
</ButtonBase> </ButtonBase>
<Spacer height="6px" /> <Spacer height="6px" />
<AppInfoUserName>{app?.name}</AppInfoUserName> <AppInfoUserName>{app?.name}</AppInfoUserName>
<Spacer height="3px" /> <Spacer height="3px" />
<AppRating app={app} myName={myName} /> <AppRating app={app} myName={myName} />
</AppInfoSnippetMiddle> </AppInfoSnippetMiddle>
</AppInfoSnippetLeft> </AppInfoSnippetLeft>
<AppInfoSnippetRight <AppInfoSnippetRight
sx={{ sx={{
gap: '10px', gap: '10px',
@ -157,7 +164,7 @@ export const AppInfoSnippet = ({
setSettingsLocalLastUpdated(Date.now()); setSettingsLocalLastUpdated(Date.now());
}} }}
sx={{ sx={{
backgroundColor: '#359ff7ff', backgroundColor: theme.palette.background.paper,
opacity: isSelectedAppPinned ? 0.6 : 1, opacity: isSelectedAppPinned ? 0.6 : 1,
}} }}
> >
@ -174,7 +181,9 @@ export const AppInfoSnippet = ({
}); });
}} }}
sx={{ sx={{
backgroundColor: isInstalled ? '#0091E1' : '#247C0E', backgroundColor: isInstalled
? '#0091E1'
: theme.palette.background.paper,
}} }}
> >
<AppDownloadButtonText> <AppDownloadButtonText>

View File

@ -91,6 +91,7 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
} }
} }
}, []); }, []);
useEffect(() => { useEffect(() => {
if (hasCalledRef.current) return; if (hasCalledRef.current) return;
if (!app) return; if (!app) return;
@ -108,6 +109,7 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
message: `Would you like to rate this app a rating of ${newValue}?. It will create a POLL tx.`, message: `Would you like to rate this app a rating of ${newValue}?. It will create a POLL tx.`,
publishFee: fee.fee + ' QORT', publishFee: fee.fee + ' QORT',
}); });
if (hasPublishedRating === false) { if (hasPublishedRating === false) {
const pollName = `app-library-${app.service}-rating-${app.name}`; const pollName = `app-library-${app.service}-rating-${app.name}`;
const pollOptions = [`1, 2, 3, 4, 5, initialValue-${newValue}`]; const pollOptions = [`1, 2, 3, 4, 5, initialValue-${newValue}`];

View File

@ -36,6 +36,24 @@ export const AppsContainer = styled(Box)(({ theme }) => ({
width: '90%', width: '90%',
})); }));
export const AppsDesktopLibraryHeader = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.background.default,
color: theme.palette.text.primary,
display: 'flex',
flexDirection: 'column',
flexShrink: 0,
width: '100%',
}));
export const AppsDesktopLibraryBody = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.background.default,
color: theme.palette.text.primary,
display: 'flex',
flexDirection: 'column',
flexGrow: 1,
width: '100%',
}));
export const AppsLibraryContainer = styled(Box)(({ theme }) => ({ export const AppsLibraryContainer = styled(Box)(({ theme }) => ({
alignItems: 'center', alignItems: 'center',
backgroundColor: theme.palette.background.default, backgroundColor: theme.palette.background.default,
@ -177,13 +195,11 @@ export const AppDownloadButton = styled(ButtonBase)(({ theme }) => ({
width: '101px', width: '101px',
})); }));
export const AppDownloadButtonText = styled(Typography)(({ theme }) => ({ export const AppDownloadButtonText = styled(Typography)({
backgroundColor: theme.palette.background.default,
color: theme.palette.text.primary,
fontSize: '14px', fontSize: '14px',
fontWeight: 500, fontWeight: 500,
lineHeight: 1.2, lineHeight: 1.2,
})); });
export const AppPublishTagsContainer = styled(Box)(({ theme }) => ({ export const AppPublishTagsContainer = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.background.default, backgroundColor: theme.palette.background.default,

View File

@ -1,23 +1,21 @@
import { useContext, useEffect, useMemo, useRef, useState } from 'react'; import { useContext, useEffect, useMemo, useRef, useState } from 'react';
import { import {
AppLibrarySubTitle, AppLibrarySubTitle,
AppsDesktopLibraryBody,
AppsDesktopLibraryHeader,
AppsLibraryContainer, AppsLibraryContainer,
AppsSearchContainer, AppsSearchContainer,
AppsSearchLeft, AppsSearchLeft,
AppsSearchRight, AppsSearchRight,
AppsWidthLimiter, AppsWidthLimiter,
} from './Apps-styles'; } from './Apps-styles';
import { ButtonBase, InputBase, styled } from '@mui/material'; import { ButtonBase, InputBase, styled, useTheme } from '@mui/material';
import { MyContext } from '../../App'; import { MyContext } from '../../App';
import SearchIcon from '@mui/icons-material/Search'; import SearchIcon from '@mui/icons-material/Search';
import IconClearInput from '../../assets/svgs/ClearInput.svg'; import IconClearInput from '../../assets/svgs/ClearInput.svg';
import { Spacer } from '../../common/Spacer'; import { Spacer } from '../../common/Spacer';
import { AppInfoSnippet } from './AppInfoSnippet'; import { AppInfoSnippet } from './AppInfoSnippet';
import { Virtuoso } from 'react-virtuoso'; import { Virtuoso } from 'react-virtuoso';
import {
AppsDesktopLibraryBody,
AppsDesktopLibraryHeader,
} from './AppsDesktop-styles';
const ScrollerStyled = styled('div')({ const ScrollerStyled = styled('div')({
// Hide scrollbar for WebKit browsers (Chrome, Safari) // Hide scrollbar for WebKit browsers (Chrome, Safari)
@ -60,6 +58,7 @@ export const AppsCategoryDesktop = ({
}) => { }) => {
const [searchValue, setSearchValue] = useState(''); const [searchValue, setSearchValue] = useState('');
const virtuosoRef = useRef(); const virtuosoRef = useRef();
const theme = useTheme();
const { rootHeight } = useContext(MyContext); const { rootHeight } = useContext(MyContext);
const categoryList = useMemo(() => { const categoryList = useMemo(() => {
@ -148,7 +147,13 @@ export const AppsCategoryDesktop = ({
<InputBase <InputBase
value={searchValue} value={searchValue}
onChange={(e) => setSearchValue(e.target.value)} onChange={(e) => setSearchValue(e.target.value)}
sx={{ ml: 1, flex: 1 }} sx={{
background: theme.palette.background.paper,
borderRadius: '6px',
flex: 1,
ml: 1,
paddingLeft: '12px',
}}
placeholder="Search for apps" placeholder="Search for apps"
inputProps={{ inputProps={{
'aria-label': 'Search for apps', 'aria-label': 'Search for apps',

View File

@ -1,24 +0,0 @@
import {
AppBar,
Button,
Toolbar,
Typography,
Box,
TextField,
InputLabel,
ButtonBase,
} from "@mui/material";
import { styled } from "@mui/system";
export const AppsDesktopLibraryHeader = styled(Box)(({ theme }) => ({
display: "flex",
flexDirection: 'column',
flexShrink: 0,
width: '100%'
}));
export const AppsDesktopLibraryBody = styled(Box)(({ theme }) => ({
display: "flex",
flexDirection: 'column',
flexGrow: 1,
width: '100%'
}));

View File

@ -5,6 +5,8 @@ import {
AppCircleLabel, AppCircleLabel,
AppLibrarySubTitle, AppLibrarySubTitle,
AppsContainer, AppsContainer,
AppsDesktopLibraryBody,
AppsDesktopLibraryHeader,
AppsLibraryContainer, AppsLibraryContainer,
AppsSearchContainer, AppsSearchContainer,
AppsSearchLeft, AppsSearchLeft,
@ -37,10 +39,6 @@ import { Spacer } from '../../common/Spacer';
import { AppInfoSnippet } from './AppInfoSnippet'; import { AppInfoSnippet } from './AppInfoSnippet';
import { Virtuoso } from 'react-virtuoso'; import { Virtuoso } from 'react-virtuoso';
import { executeEvent } from '../../utils/events'; import { executeEvent } from '../../utils/events';
import {
AppsDesktopLibraryBody,
AppsDesktopLibraryHeader,
} from './AppsDesktop-styles';
import { ShowMessageReturnButton } from '../Group/Forum/Mail-styles'; import { ShowMessageReturnButton } from '../Group/Forum/Mail-styles';
const officialAppList = [ const officialAppList = [
@ -204,7 +202,13 @@ export const AppsLibraryDesktop = ({
<InputBase <InputBase
value={searchValue} value={searchValue}
onChange={(e) => setSearchValue(e.target.value)} onChange={(e) => setSearchValue(e.target.value)}
sx={{ ml: 1, flex: 1 }} sx={{
background: theme.palette.background.paper,
borderRadius: '6px',
flex: 1,
ml: 1,
paddingLeft: '12px',
}}
placeholder="Search for apps" placeholder="Search for apps"
inputProps={{ inputProps={{
'aria-label': 'Search for apps', 'aria-label': 'Search for apps',