Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to about and debug windows #3157

Merged
merged 4 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified images/session/session_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 15 additions & 10 deletions ts/components/AboutView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ const StyledContent = styled(Flex)`
}

img:first-child {
filter: brightness(0) saturate(100%) invert(75%) sepia(84%) saturate(3272%) hue-rotate(103deg)
brightness(106%) contrast(103%);
margin: var(--margins-2xl) 0 var(--margins-lg);
}

img:nth-child(2) {
filter: var(--session-logo-text-current-filter);
margin-bottom: var(--margins-xl);
}

Expand All @@ -40,13 +43,14 @@ const StyledContent = styled(Flex)`

export const AboutView = () => {
// Add debugging metadata - environment if not production, app instance name
const states = [];
const environmentStates = [];

if (window.getEnvironment() !== 'production') {
states.push(window.getEnvironment());
environmentStates.push(window.getEnvironment());
}

if (window.getAppInstance()) {
states.push(window.getAppInstance());
environmentStates.push(window.getAppInstance());
}

const versionInfo = `v${window.getVersion()}`;
Expand All @@ -63,7 +67,7 @@ export const AboutView = () => {
}, []);

return (
<SessionTheme>
<SessionTheme runSetup={false}>
<SessionToastContainer />
<StyledContent
container={true}
Expand All @@ -83,7 +87,6 @@ export const AboutView = () => {
width={192}
height={26}
/>

<CopyToClipboardButton
className="version"
text={versionInfo}
Expand All @@ -95,11 +98,13 @@ export const AboutView = () => {
buttonType={SessionButtonType.Simple}
/>
<CopyToClipboardButton className="os" text={osInfo} buttonType={SessionButtonType.Simple} />
<CopyToClipboardButton
className="environment"
text={states.join(' - ')}
buttonType={SessionButtonType.Simple}
/>
{environmentStates.length ? (
<CopyToClipboardButton
className="environment"
text={environmentStates.join(' - ')}
buttonType={SessionButtonType.Simple}
/>
) : null}
<a href="https://getsession.org">https://getsession.org</a>
<br />
<a className="privacy" href="https://getsession.org/privacy-policy">
Expand Down
20 changes: 17 additions & 3 deletions ts/components/DebugLogView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { switchThemeTo } from '../themes/switchTheme';
import { fetchNodeLog } from '../util/logging';
import { SessionButton, SessionButtonType } from './basic/SessionButton';
import { SessionIconButton } from './icon';
import { CopyToClipboardButton } from './buttons';
import { Flex } from './basic/Flex';

const StyledContent = styled.div`
background-color: var(--modal-background-content-color);
Expand Down Expand Up @@ -54,7 +56,14 @@ const DebugLogTextArea = (props: { content: string }) => {

const DebugLogButtons = (props: { content: string }) => {
return (
<div className="buttons">
<Flex
container={true}
width={'fit-content'}
justifyContent={'flex-start'}
alignItems={'center'}
flexGap="var(--margins-md)"
className="buttons"
>
<SessionButton
text={window.i18n('saveLogToDesktop')}
buttonType={SessionButtonType.Simple}
Expand All @@ -66,7 +75,12 @@ const DebugLogButtons = (props: { content: string }) => {
(window as any).saveLog(props.content);
}}
/>
</div>
<CopyToClipboardButton
copyContent={props.content}
buttonType={SessionButtonType.Simple}
hotkey={true}
/>
</Flex>
);
};

Expand Down Expand Up @@ -107,7 +121,7 @@ export const DebugLogView = () => {
}, []);

return (
<SessionTheme>
<SessionTheme runSetup={false}>
<StyledContent>
<div>
<SessionIconButton
Expand Down
16 changes: 14 additions & 2 deletions ts/themes/SessionTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SettingsKey } from '../data/settings-key';
import { getOppositeTheme, isThemeMismatched } from '../util/theme';
import { THEME_GLOBALS, setThemeValues } from './globals';
import { switchThemeTo } from './switchTheme';
import { Storage } from '../util/storage';

export async function ensureThemeConsistency(): Promise<boolean> {
const theme = window.Events.getThemeSetting();
Expand Down Expand Up @@ -52,10 +53,21 @@ const setupTheme = async () => {
}
};

export const SessionTheme = ({ children }: { children: ReactNode }) => {
export const SessionTheme = ({
children,
runSetup = true,
}: {
children: ReactNode;
/** If we don't have access to some window object functions we may skip theme consistency checks */
runSetup?: boolean;
}) => {
useMount(() => {
setThemeValues(THEME_GLOBALS);
void setupTheme();
if (runSetup) {
void Storage.onready(() => {
void setupTheme();
});
}
});
return children;
};
Loading