Skip to content

Commit 18d64c1

Browse files
authored
Merge branch 'dev' into dependabot-upgrades
2 parents f8b192b + 6888b2d commit 18d64c1

File tree

12 files changed

+87
-41
lines changed

12 files changed

+87
-41
lines changed

src/app/views/App.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
FluentProvider,
3-
teamsHighContrastTheme,
43
Theme,
54
webDarkTheme,
65
webLightTheme
@@ -256,8 +255,7 @@ class App extends Component<IAppProps, IAppState> {
256255
public render() {
257256
const fluentV9Themes: Record<string, Theme> = {
258257
light: webLightTheme,
259-
dark: webDarkTheme,
260-
'high-contrast': teamsHighContrastTheme
258+
dark: webDarkTheme
261259
};
262260
return (
263261
<FluentProvider theme={fluentV9Themes[this.props.appTheme]}>

src/app/views/main-header/settings/ThemeChooser.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { PopupsComponent } from '../../../services/context/popups-context';
66
import { changeTheme } from '../../../services/slices/theme.slice';
77
import { translateMessage } from '../../../utils/translate-messages';
88
import { useIconOptionStyles, useRadioGroupStyles } from './ThemeChooser.styles';
9-
import { BrightnessHigh24Regular, WeatherMoon24Regular, DarkTheme24Regular} from '@fluentui/react-icons';
9+
import { BrightnessHigh24Regular, WeatherMoon24Regular} from '@fluentui/react-icons';
1010

1111
const availableThemes = [
1212
{
@@ -18,11 +18,6 @@ const availableThemes = [
1818
key: 'dark',
1919
displayName: 'Dark',
2020
icon: <WeatherMoon24Regular />
21-
},
22-
{
23-
key: 'high-contrast',
24-
displayName: 'High Contrast',
25-
icon: <DarkTheme24Regular />
2621
}
2722
];
2823

src/app/views/sidebar/Sidebar.styles.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ export const useSidebarStyles = makeStyles({
2929
maxWidth: '100%'
3030
},
3131
activeLeaf: {
32-
backgroundColor: tokens.colorNeutralBackground3Hover
32+
backgroundColor: tokens.colorNeutralBackground3Hover,
33+
'@media (forced-colors: active)': {
34+
backgroundColor: 'Highlight',
35+
color: 'HighlightText',
36+
forcedColorAdjust: 'none',
37+
// Adding border for better visibility in high contrast mode
38+
outlineWidth: '2px',
39+
outlineStyle: 'solid',
40+
outlineColor: 'ButtonText'
41+
}
3342
}
3443
})

src/app/views/sidebar/history/History.styles.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ export const useHistoryStyles = makeStyles({
99
alignItems: 'center',
1010
gap: '2px'
1111
},
12+
button: {
13+
border: 'none'
14+
},
1215
badgeContainer: {
1316
minWidth: '50px',
1417
display: 'inline-flex'

src/app/views/sidebar/history/History.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ import {
3434
} from '@fluentui/react-components';
3535
import {
3636
AddSquare20Regular,
37-
ArrowDownloadRegular,
38-
DeleteRegular,
39-
MoreHorizontalRegular,
37+
ArrowDownload20Regular,
38+
Delete20Regular,
39+
MoreHorizontal20Regular,
4040
SubtractSquare20Regular
4141
} from '@fluentui/react-icons';
4242
import React, { useEffect, useRef, useState } from 'react';
@@ -143,14 +143,15 @@ const GroupIcons = (props: AsideGroupIconsProps)=>{
143143
<Tooltip withArrow relationship="label" content={`${translateMessage('Export')} ${groupName} queries`}>
144144
<Button onClick={
145145
(e) => handleDownloadHistoryGroup(e,groupName, historyItems )}
146-
appearance="subtle" icon={<ArrowDownloadRegular/>}></Button>
146+
appearance="subtle" icon={<ArrowDownload20Regular/>} className={styles.button}></Button>
147147
</Tooltip>
148148
<Dialog open={open} onOpenChange={(_event, data) => setOpen(data.open)}>
149149
<DialogTrigger disableButtonEnhancement>
150150
<Tooltip withArrow relationship="label" content={`${translateMessage('Delete')} ${groupName} queries`}>
151151
<Button
152152
appearance="subtle"
153-
icon={<DeleteRegular/>}
153+
icon={<Delete20Regular/>}
154+
className={styles.button}
154155
onClick={(e) => {
155156
e.stopPropagation();
156157
setOpen(true);
@@ -198,6 +199,7 @@ interface HistoryProps {
198199
const HistoryItems = (props: HistoryProps)=>{
199200
const dispatch = useAppDispatch();
200201
const sidebarStyles = useSidebarStyles();
202+
const historyStyles = useHistoryStyles();
201203
const {groups, history} = props
202204
const shouldGenerateGroups = useRef(true);
203205
const [selectedItemKey, setSelectedItemKey] = useState<string | null>(null);
@@ -348,6 +350,7 @@ const HistoryItems = (props: HistoryProps)=>{
348350
aria-label={translateMessage('Remove from collection')}
349351
appearance='transparent'
350352
icon={<SubtractSquare20Regular />}
353+
className={historyStyles.button}
351354
onClick={ (e: React.MouseEvent<HTMLButtonElement>) => {
352355
e.stopPropagation();
353356
handleRemoveFromCollection(h);
@@ -365,6 +368,7 @@ const HistoryItems = (props: HistoryProps)=>{
365368
aria-label={translateMessage('Add to collection')}
366369
appearance='transparent'
367370
icon={<AddSquare20Regular />}
371+
className={historyStyles.button}
368372
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
369373
e.stopPropagation();
370374
handleAddToCollection(h);
@@ -432,6 +436,7 @@ interface HistoryItemActionMenuProps {
432436

433437
const HistoryItemActionMenu = (props: HistoryItemActionMenuProps)=>{
434438
const dispatch = useAppDispatch()
439+
const historyStyles = useHistoryStyles()
435440
const {item} = props
436441

437442
const handleExportQuery = (query: IHistoryItem)=>{
@@ -457,21 +462,28 @@ const HistoryItemActionMenu = (props: HistoryItemActionMenuProps)=>{
457462
}
458463
return <Menu>
459464
<MenuTrigger disableButtonEnhancement>
460-
<Button tabIndex={0} appearance='subtle' icon={<MoreHorizontalRegular/>}></Button>
465+
<Button
466+
tabIndex={0}
467+
appearance='subtle'
468+
icon={<MoreHorizontal20Regular />}
469+
className={historyStyles.button}
470+
></Button>
461471
</MenuTrigger>
462472

463473
<MenuPopover>
464474
<MenuList>
465475
<MenuGroup>
466476
<MenuGroupHeader>{translateMessage('actions')}</MenuGroupHeader>
467-
<MenuItem icon={<ArrowDownloadRegular/>}
477+
<MenuItem icon={<ArrowDownload20Regular/>}
478+
className={historyStyles.button}
468479
onClick={(e) => {
469480
e.stopPropagation();
470481
handleExportQuery(item);
471482
}}>
472483
{translateMessage('Export')}
473484
</MenuItem>
474-
<MenuItem icon={<DeleteRegular/>}
485+
<MenuItem icon={<Delete20Regular/>}
486+
className={historyStyles.button}
475487
onClick={(e) => {
476488
e.stopPropagation();
477489
handleDeleteQuery(item);

src/app/views/sidebar/resource-explorer/ResourceExplorer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ const ResourceExplorer = () => {
191191
<Button
192192
aria-label={translateMessage('Remove from collection')}
193193
appearance='transparent'
194+
className={resourceExplorerStyles.button}
194195
icon={<SubtractSquare20Regular />}
195196
onClick={handleRemoveFromCollection}
196197
/>
@@ -205,6 +206,7 @@ const ResourceExplorer = () => {
205206
aria-label={translateMessage('Add to collection')}
206207
appearance='transparent'
207208
aria-describedby='tooltip'
209+
className={resourceExplorerStyles.button}
208210
icon={<AddSquare20Regular />}
209211
onClick={handleAddToCollection}
210212
/>

src/app/views/sidebar/resource-explorer/resourceExplorerStyles.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,19 @@ export const useResourceExplorerStyles = makeStyles({
4141
display: 'flex',
4242
alignItems: 'center'
4343
},
44+
button: {
45+
border: 'none'
46+
},
4447
treeItemLayout: {
4548
width: '100%',
4649
':hover, :focus, :focus-visible, :focus-within': {
4750
backgroundColor: tokens.colorNeutralBackground3Hover,
48-
color: tokens.colorNeutralForeground2BrandHover
51+
color: tokens.colorNeutralForeground2BrandHover,
52+
'@media (forced-colors: active)': {
53+
backgroundColor: 'Highlight',
54+
color: 'HighlightText',
55+
forcedColorAdjust: 'none'
56+
}
4957
},
5058
'> div.fui-TreeItemLayout__main': {
5159
width: '100%'
@@ -57,7 +65,12 @@ export const useResourceExplorerStyles = makeStyles({
5765
},
5866
'&:hover .actions, &:focus-within .actions, &:focus-visible .actions, &:focus .actions': {
5967
display: 'flex',
60-
alignItems: 'center'
68+
alignItems: 'center',
69+
'@media (forced-colors: active)': {
70+
backgroundColor: 'Highlight',
71+
color: 'HighlightText',
72+
forcedColorAdjust: 'none'
73+
}
6174
}
6275
}
6376
});

src/app/views/sidebar/sample-queries/SampleQueries.styles.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { makeStyles, tokens } from '@fluentui/react-components';
2-
export const useStyles = makeStyles({
2+
3+
const forcedColorsActiveStyles = {
4+
'@media (forced-colors: active)': {
5+
backgroundColor: 'Highlight',
6+
color: 'HighlightText',
7+
forcedColorAdjust: 'none'
8+
}
9+
};export const useStyles = makeStyles({
310
container: {
411
marginTop: '8px'
512
},
@@ -25,7 +32,23 @@ export const useStyles = makeStyles({
2532
maxHeight: 'calc(100vh - 100px)'
2633
},
2734
itemLayout: {
28-
paddingLeft: tokens.spacingHorizontalXXL
35+
paddingLeft: tokens.spacingHorizontalXXL,
36+
'&:hover, &:focus, &:focus-visible, &:focus-within': {
37+
'@media (forced-colors: active)': {
38+
backgroundColor: 'Highlight',
39+
color: 'HighlightText',
40+
forcedColorAdjust: 'none'
41+
}
42+
}
43+
},
44+
branchItemLayout: {
45+
'&:hover, &:focus, &:focus-visible, &:focus-within': {
46+
'@media (forced-colors: active)': {
47+
backgroundColor: 'Highlight',
48+
color: 'HighlightText',
49+
forcedColorAdjust: 'none'
50+
}
51+
}
2952
},
3053
focusableLink: {
3154
'&:focus, &:focus-visible': {

src/app/views/sidebar/sample-queries/SampleQueries.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ const Samples: React.FC<SamplesProps> = ({ queries, groups, searchValue }) => {
479479
group.count + translateMessage('Resources')}
480480
>
481481
<TreeItemLayout
482+
className={styles.branchItemLayout}
482483
aside={
483484
<Badge appearance='tint' color='informative' aria-label={group.count + translateMessage('Resources')}>
484485
{group.count}

src/index.tsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,15 @@ function setCurrentTheme(): void {
6868
applyCurrentTheme(currentTheme);
6969
}
7070
function getOSTheme(): string {
71-
let currentSystemTheme: string;
72-
const currentSystemThemeDark = window.matchMedia(
73-
'(prefers-color-scheme: dark)'
74-
);
75-
76-
const currentSystemThemeLight = window.matchMedia(
77-
'(prefers-color-scheme: light)'
78-
);
79-
80-
if (currentSystemThemeDark.matches === true) {
81-
currentSystemTheme = 'dark';
82-
} else if (currentSystemThemeLight.matches === true) {
83-
currentSystemTheme = 'light';
84-
} else {
85-
currentSystemTheme = 'high-contrast';
71+
const currentSystemThemeDark = window.matchMedia('(prefers-color-scheme: dark)');
72+
const currentSystemThemeLight = window.matchMedia('(prefers-color-scheme: light)');
73+
if (currentSystemThemeDark.matches) {
74+
return 'dark';
75+
} else if (currentSystemThemeLight.matches) {
76+
return 'light';
8677
}
8778

88-
return currentSystemTheme;
79+
return 'light';
8980
}
9081

9182
function applyCurrentTheme(themeToApply: string): void {

0 commit comments

Comments
 (0)