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

feat: Popover for Upgrade icon in the status bar #14485

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
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
2 changes: 0 additions & 2 deletions packages/components/src/components/Image/images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export const SVG_IMAGES = {
DEVICE_ANOTHER_SESSION: 'device-another-session.svg',
CONNECT_DEVICE: 'connect-device.svg',
ERROR_404: 'error-404.svg',
EARLY_ACCESS: 'early-access.svg',
EARLY_ACCESS_DISABLE: 'early-access-disable.svg',
INVITY_LOGO: 'invity-logo.svg',
COINMARKET_AVATAR: 'coinmarket-avatar.svg',
COINMARKET_SUCCESS: 'coinmarket-success.svg',
Expand Down
8 changes: 6 additions & 2 deletions packages/components/src/components/NewModal/NewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
Elevation,
mapElevationToBackground,
mapElevationToBackgroundToken,
nextElevation,
prevElevation,
spacingsPx,
} from '@trezor/theme';

Expand Down Expand Up @@ -147,7 +149,9 @@ const NewModalBase = ({
const frameProps = pickAndPrepareFrameProps(rest, allowedNewModalFrameProps);
const { scrollElementRef, onScroll, ShadowContainer, ShadowTop, ShadowBottom } =
useScrollShadow();
const modalBackgroundColor = mapElevationToBackgroundToken({ $elevation: MODAL_ELEVATION });
const modalBackgroundColor = mapElevationToBackgroundToken({
$elevation: nextElevation[MODAL_ELEVATION],
});
const hasHeader = onBackClick || onCancel || heading || description;

useEvent('keydown', (e: KeyboardEvent) => {
Expand All @@ -157,7 +161,7 @@ const NewModalBase = ({
});

return (
<ElevationContext baseElevation={MODAL_ELEVATION}>
<ElevationContext baseElevation={prevElevation[MODAL_ELEVATION]}>
<NewModalContext.Provider value={{ variant }}>
<Container
$elevation={MODAL_ELEVATION}
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/components/Tooltip/TooltipBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ const TooltipContainerStyled = styled.div<TooltipContainerStyledProps>`
border-radius: ${TOOLTIP_BORDER_RADIUS};
text-align: left;
border: solid 1.5px ${palette.darkGray100};
margin: ${spacingsPx.xxxs};
max-width: ${props => props.$maxWidth}px;
${typography.hint}

${typography.hint}
> div {
padding: ${({ $isLarge, $isWithHeader }) => getContainerPadding($isLarge, $isWithHeader)};
}
Expand Down
19 changes: 15 additions & 4 deletions packages/components/src/config/colors.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
import { boxShadows, colorVariants } from '@trezor/theme';

// TODO: button hover color could be derived from its based color by applying something like opacity/darkening
// same goes for gradients
// TODO: button hover color could be derived from its based color
// by applying something like opacity/darkening, same goes for gradients

type LightThemeProps = typeof intermediaryTheme.light;
type DarkThemeProps = typeof intermediaryTheme.dark;

// extracts values for common props (eg. NEUE_BG_GREEN: "#00854D" | "#e3ede0")
// Extracts values for common props (eg. NEUE_BG_GREEN: "#00854D" | "#e3ede0")
type CommonThemeProps = {
[K in keyof LightThemeProps & keyof DarkThemeProps]: LightThemeProps[K] | DarkThemeProps[K];
};

type PropsOnlyInLightTheme = Omit<LightThemeProps, keyof DarkThemeProps>;
type PropsOnlyInDarkTheme = Omit<DarkThemeProps, keyof LightThemeProps>;

// all common theme props and their values are nicely listed, props that are specific to given theme are marked optional
/**
* IMPORTANT:
*
* You have to do this in the every package where you are accessing these theme props
* 1) create `styled.d.ts` file in the root of the project with overwrite of DefaultTheme
* 2) add `typescript-styled-plugin` into the packages devDependencies
*
* See `suite` package for reference.
*/

// All common theme props and their values are nicely listed,
// props that are specific to given theme are marked optional.
export type SuiteThemeColors = CommonThemeProps &
Partial<PropsOnlyInDarkTheme> &
Partial<PropsOnlyInLightTheme>;
Expand Down
Empty file.
10 changes: 0 additions & 10 deletions packages/suite-data/files/images/svg/early-access-disable.svg

This file was deleted.

8 changes: 0 additions & 8 deletions packages/suite-data/files/images/svg/early-access.svg

This file was deleted.

3 changes: 2 additions & 1 deletion packages/suite-desktop-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@types/react": "18.2.79",
"@types/react-dom": "18.2.19",
"stylelint": "^16.2.1",
"stylelint-config-standard": "^36.0.0"
"stylelint-config-standard": "^36.0.0",
"typescript-styled-plugin": "^0.18.3"
}
}
20 changes: 8 additions & 12 deletions packages/suite-desktop-ui/src/support/DesktopUpdater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
import { UpdateState } from 'src/reducers/suite/desktopUpdateReducer';
import { ModalContextProvider } from 'src/support/suite/ModalContext';
import { getAppUpdatePayload } from 'src/utils/suite/analytics';
import { selectRouteName } from 'src/reducers/suite/routerReducer';

import { Available } from './DesktopUpdater/Available';
import { Downloading } from './DesktopUpdater/Downloading';
Expand All @@ -33,11 +32,8 @@ interface DesktopUpdaterProps {
export const DesktopUpdater = ({ children }: DesktopUpdaterProps) => {
const dispatch = useDispatch();
const { desktopUpdate } = useSelector(state => state);
const routeName = useSelector(selectRouteName);

// Closing a modal opened by auto updater outside of device settings might confuse some users,
// especially on app start if closing it unexpectedly by clicking outside.
const isSettingsRoute = routeName === 'settings-index';
const desktopUpdateState = desktopUpdate.state;

useEffect(() => {
desktopApi.on('update/allow-prerelease', params => dispatch(allowPrerelease(params)));
Expand Down Expand Up @@ -90,41 +86,41 @@ export const DesktopUpdater = ({ children }: DesktopUpdaterProps) => {
}

// Non visible states
if ([UpdateState.Checking, UpdateState.NotAvailable].includes(desktopUpdate.state)) {
if ([UpdateState.Checking, UpdateState.NotAvailable].includes(desktopUpdateState)) {
return false;
}

const isEarlyAccessState = [
UpdateState.EarlyAccessDisable,
UpdateState.EarlyAccessEnable,
].includes(desktopUpdate.state);
].includes(desktopUpdateState);

// Enable to setup Early Access even after updater error (when desktopUpdate.latest is undefined).
if (!isEarlyAccessState && !desktopUpdate.latest) {
return false;
}

return true;
}, [desktopUpdate.modalVisibility, desktopUpdate.state, desktopUpdate.latest]);
}, [desktopUpdate.modalVisibility, desktopUpdateState, desktopUpdate.latest]);

const getUpdateModal = () => {
switch (desktopUpdate.state) {
switch (desktopUpdateState) {
case UpdateState.EarlyAccessEnable:
return <EarlyAccessEnable hideWindow={hideWindow} />;
case UpdateState.EarlyAccessDisable:
return <EarlyAccessDisable hideWindow={hideWindow} />;
case UpdateState.Available:
return (
<Available
hideWindow={hideWindow}
onCancel={hideWindow}
latest={desktopUpdate.latest}
isCancelable={isSettingsRoute}
isAutomaticUpdateEnabled={desktopUpdate.isAutomaticUpdateEnabled}
/>
);
case UpdateState.Downloading:
return <Downloading hideWindow={hideWindow} progress={desktopUpdate.progress} />;
case UpdateState.Ready:
return <Ready hideWindow={hideWindow} isCancelable={isSettingsRoute} />;
return <Ready hideWindow={hideWindow} />;
default:
return null;
}
Expand Down
Loading
Loading