Skip to content

Commit a97adbb

Browse files
committed
fix: fixed theming issues
1 parent 4d8c377 commit a97adbb

File tree

2 files changed

+51
-13
lines changed
  • packages/bruno-app/src

2 files changed

+51
-13
lines changed

packages/bruno-app/src/components/Sidebar/GoldenEdition/index.js

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
22
import Modal from 'components/Modal/index';
33
import { PostHog } from 'posthog-node';
44
import { uuid } from 'utils/common';
5-
import { IconHeart, IconUser, IconUsers } from '@tabler/icons';
5+
import { IconHeart, IconUser, IconUsers, IconPlus } from '@tabler/icons';
66
import platformLib from 'platform';
77
import StyledWrapper from './StyledWrapper';
88
import { useTheme } from 'providers/Theme/index';
@@ -59,7 +59,7 @@ const CheckIcon = () => {
5959
};
6060

6161
const GoldenEdition = ({ onClose }) => {
62-
const { storedTheme } = useTheme();
62+
const { displayedTheme } = useTheme();
6363

6464
useEffect(() => {
6565
const anonymousId = getAnonymousTrackingId();
@@ -85,11 +85,10 @@ const GoldenEdition = ({ onClose }) => {
8585
});
8686
};
8787

88-
const goldenEditon = [
88+
const goldenEditonIndividuals = [
8989
'Inbuilt Bru File Explorer',
9090
'Visual Git (Like Gitlens for Vscode)',
9191
'GRPC, Websocket, SocketIO, MQTT',
92-
'Intergration with Secret Managers',
9392
'Load Data from File for Collection Run',
9493
'Developer Tools',
9594
'OpenAPI Designer',
@@ -98,16 +97,25 @@ const GoldenEdition = ({ onClose }) => {
9897
'Custom Themes'
9998
];
10099

100+
const goldenEditonOrganizations = [
101+
'Centralized License Management',
102+
'Intergration with Secret Managers',
103+
'Private Collection Registry',
104+
'Request Forms',
105+
'Priority Support'
106+
];
107+
101108
const [pricingOption, setPricingOption] = useState('individuals');
102109

103110
const handlePricingOptionChange = (option) => {
104111
setPricingOption(option);
105112
};
113+
console.log(displayedTheme);
106114

107-
const themeBasedContainerClassNames = storedTheme === 'light' ? 'text-gray-900' : 'text-white';
108-
const themeBasedTabContainerClassNames = storedTheme === 'light' ? 'bg-gray-200' : 'bg-gray-800';
115+
const themeBasedContainerClassNames = displayedTheme === 'light' ? 'text-gray-900' : 'text-white';
116+
const themeBasedTabContainerClassNames = displayedTheme === 'light' ? 'bg-gray-200' : 'bg-gray-800';
109117
const themeBasedActiveTabClassNames =
110-
storedTheme === 'light' ? 'bg-white text-gray-900 font-medium' : 'bg-gray-700 text-white font-medium';
118+
displayedTheme === 'light' ? 'bg-white text-gray-900 font-medium' : 'bg-gray-700 text-white font-medium';
111119

112120
return (
113121
<StyledWrapper>
@@ -169,12 +177,29 @@ const GoldenEdition = ({ onClose }) => {
169177
<HeartIcon />
170178
<span>Support Bruno's Development</span>
171179
</li>
172-
{goldenEditon.map((item, index) => (
173-
<li className="flex items-center space-x-3" key={index}>
174-
<CheckIcon />
175-
<span>{item}</span>
176-
</li>
177-
))}
180+
{pricingOption === 'individuals' ? (
181+
<>
182+
{goldenEditonIndividuals.map((item, index) => (
183+
<li className="flex items-center space-x-3" key={index}>
184+
<CheckIcon />
185+
<span>{item}</span>
186+
</li>
187+
))}
188+
</>
189+
) : (
190+
<>
191+
<li className="flex items-center space-x-3 pb-4">
192+
<IconPlus size={16} strokeWidth={1.5} style={{ marginLeft: '2px' }} />
193+
<span>Everything in the Individual Plan</span>
194+
</li>
195+
{goldenEditonOrganizations.map((item, index) => (
196+
<li className="flex items-center space-x-3" key={index}>
197+
<CheckIcon />
198+
<span>{item}</span>
199+
</li>
200+
))}
201+
</>
202+
)}
178203
</ul>
179204
</div>
180205
</Modal>

packages/bruno-app/src/providers/Theme/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,25 @@ export const ThemeProvider = (props) => {
1717
});
1818
}, []);
1919

20+
useEffect(() => {
21+
if (storedTheme === 'system') {
22+
const isBrowserThemeLight = window.matchMedia('(prefers-color-scheme: light)').matches;
23+
setDisplayedTheme(isBrowserThemeLight ? 'light' : 'dark');
24+
} else {
25+
setDisplayedTheme(storedTheme);
26+
}
27+
}, [storedTheme, setDisplayedTheme, window.matchMedia]);
28+
29+
// storedTheme can have 3 values: 'light', 'dark', 'system'
30+
// displayedTheme can have 2 values: 'light', 'dark'
31+
2032
const theme = storedTheme === 'system' ? themes[displayedTheme] : themes[storedTheme];
2133
const themeOptions = Object.keys(themes);
2234
const value = {
2335
theme,
2436
themeOptions,
2537
storedTheme,
38+
displayedTheme,
2639
setStoredTheme
2740
};
2841

0 commit comments

Comments
 (0)