Skip to content

Commit 5323ae7

Browse files
authored
Merge pull request #1355 from responsively-org/minor-fixes
Minor UI Polish
2 parents 6464975 + f5b0ca6 commit 5323ae7

File tree

13 files changed

+520
-821
lines changed

13 files changed

+520
-821
lines changed

desktop-app/src/main/web-permissions/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ export const WebPermissionHandlers = (mainWindow: BrowserWindow) => {
3232
urls: ['<all_urls>'],
3333
},
3434
(details, callback) => {
35-
details.requestHeaders['Accept-Language'] = store.get(
35+
const acceptLanguage = store.get(
3636
'userPreferences.webRequestHeaderAcceptLanguage'
3737
);
38+
if (acceptLanguage != null && acceptLanguage !== '') {
39+
details.requestHeaders['Accept-Language'] = store.get(
40+
'userPreferences.webRequestHeaderAcceptLanguage'
41+
);
42+
}
3843
callback({ requestHeaders: details.requestHeaders });
3944
}
4045
);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { ReactElement } from 'react';
2+
import cx from 'classnames';
3+
4+
interface Props {
5+
buttons: {
6+
content: ReactElement;
7+
srContent: string;
8+
onClick: () => void;
9+
isActive: boolean;
10+
}[];
11+
}
12+
13+
export const ButtonGroup = ({ buttons }: Props) => {
14+
return (
15+
<span className="isolate inline-flex rounded-md shadow-sm">
16+
{buttons.map(({ content, srContent, onClick, isActive }, index) => (
17+
<button
18+
type="button"
19+
className={cx(
20+
'relative inline-flex items-center px-2 py-2 text-slate-500 ring-1 ring-inset ring-slate-300 hover:bg-slate-300 focus:z-10 dark:text-slate-200 hover:dark:bg-slate-600',
21+
{
22+
'rounded-l-md': index === 0,
23+
'rounded-r-md': index === buttons.length - 1,
24+
'bg-slate-200 dark:bg-slate-600': isActive,
25+
}
26+
)}
27+
onClick={onClick}
28+
>
29+
<span className="sr-only">{srContent}</span>
30+
{content}
31+
</button>
32+
))}
33+
</span>
34+
);
35+
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const Divider = () => (
2-
<div className="my-4 w-full border-t border-gray-200 opacity-20" />
2+
<div className="my-1 w-full border-t border-gray-400 opacity-30" />
33
);

desktop-app/src/renderer/components/Masonry/MasonryLayout.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

desktop-app/src/renderer/components/Notifications/NotificationEmptyStatus.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const NotificationEmptyStatus = () => {
22
return (
3-
<div className="mb-2 text-sm text-white">
3+
<div className="mb-2">
44
<p>You are all caught up! No new notifications at the moment.</p>
55
</div>
66
);

desktop-app/src/renderer/components/Notifications/Notifications.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const Notifications = () => {
1010

1111
return (
1212
<div className="mb-4 max-h-[200px] overflow-y-auto rounded-lg p-1 px-4 shadow-lg dark:bg-slate-900">
13-
<span className="text-lg">Notifications</span>
13+
<span className="text-md">Notifications</span>
1414
<div className="mt-2">
1515
{(!notificationsState ||
1616
(notificationsState && notificationsState?.length === 0)) && (

desktop-app/src/renderer/components/ToolBar/Menu/Flyout/Bookmark/ViewAllBookmarks/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const ViewAllBookmarks = ({ bookmarks, handleBookmarkFlyout }: Props) => {
2929

3030
return (
3131
<div>
32-
<div className="absolute top-[179px] right-[322px] z-50 flex max-h-[60vh] min-h-min flex-col overflow-x-auto overflow-y-auto rounded border bg-white focus:outline-none dark:bg-slate-900 dark:ring-white dark:!ring-opacity-40">
32+
<div className="absolute right-[316px] top-0 z-50 flex max-h-[60vh] min-h-min flex-col overflow-x-auto overflow-y-auto rounded border bg-slate-100 focus:outline-none dark:bg-slate-900 dark:ring-white dark:!ring-opacity-40">
3333
{bookmarks.map((bookmark) => {
3434
return (
3535
<div key={bookmark.id}>
@@ -48,7 +48,7 @@ const ViewAllBookmarks = ({ bookmarks, handleBookmarkFlyout }: Props) => {
4848
</Button>
4949
)}
5050
</div>
51-
<div className="absolute right-[565px] top-[179px]">
51+
<div className="absolute right-[560px]">
5252
{openFlyout && (
5353
<BookmarkFlyout
5454
bookmark={currentBookmark}

desktop-app/src/renderer/components/ToolBar/Menu/Flyout/Bookmark/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ const Bookmark = () => {
2323

2424
return (
2525
<div
26+
className="relative"
2627
onMouseEnter={() => setIsOpen(true)}
2728
onMouseLeave={() => setIsOpen(false)}
2829
>
29-
<div className="">
30+
<div>
3031
<div className="relative right-2 w-80 dark:border-slate-400">
3132
<Button
3233
className="flex w-full items-center justify-between pl-6"
Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,73 @@
11
import { Icon } from '@iconify/react';
2-
import { PREVIEW_LAYOUTS } from 'common/constants';
2+
import { PREVIEW_LAYOUTS, PreviewLayout } from 'common/constants';
33
import { useDispatch, useSelector } from 'react-redux';
4+
import { ButtonGroup } from 'renderer/components/ButtonGroup';
45
import useKeyboardShortcut, {
56
SHORTCUT_CHANNEL,
67
} from 'renderer/components/KeyboardShortcutsManager/useKeyboardShortcut';
7-
import Toggle from 'renderer/components/Toggle';
88
import { selectLayout, setLayout } from 'renderer/store/features/renderer';
99

10-
const PreviewLayout = () => {
10+
const PreviewLayoutSelector = () => {
1111
const layout = useSelector(selectLayout);
1212
const dispatch = useDispatch();
1313

14-
const handleLayout = () => {
15-
if (layout === PREVIEW_LAYOUTS.FLEX)
16-
dispatch(setLayout(PREVIEW_LAYOUTS.COLUMN));
17-
else dispatch(setLayout(PREVIEW_LAYOUTS.FLEX));
14+
const handleLayout = (newLayout: PreviewLayout) => {
15+
dispatch(setLayout(newLayout));
1816
};
1917

20-
useKeyboardShortcut(SHORTCUT_CHANNEL.PREVIEW_LAYOUT, handleLayout);
18+
const toggleNextLayout = () => {
19+
const layouts = Object.values(PREVIEW_LAYOUTS);
20+
const currentIndex = layouts.findIndex((l) => l === layout);
21+
const nextIndex = (currentIndex + 1) % layouts.length;
22+
dispatch(setLayout(layouts[nextIndex]));
23+
};
24+
25+
useKeyboardShortcut(SHORTCUT_CHANNEL.PREVIEW_LAYOUT, toggleNextLayout);
2126

2227
return (
2328
<div className="flex flex-row items-center justify-start px-4">
2429
<span className="w-1/2">Preview Layout</span>
25-
<div className="flex w-fit items-center gap-3 border-l px-5 dark:border-slate-400">
26-
<Icon icon="radix-icons:layout" />
27-
<Toggle
28-
isOn={layout === PREVIEW_LAYOUTS.FLEX}
29-
onChange={(e) => {
30-
if (e.target.checked) {
31-
dispatch(setLayout(PREVIEW_LAYOUTS.FLEX));
32-
} else {
33-
dispatch(setLayout(PREVIEW_LAYOUTS.COLUMN));
34-
}
35-
}}
30+
<div className="flex w-fit items-center gap-3 px-5 ">
31+
<ButtonGroup
32+
buttons={[
33+
{
34+
content: (
35+
<div className="flex flex-col items-center text-xs">
36+
{' '}
37+
<Icon icon="radix-icons:layout" /> Column
38+
</div>
39+
),
40+
srContent: 'Horizontal Layout',
41+
onClick: () => handleLayout(PREVIEW_LAYOUTS.COLUMN),
42+
isActive: layout === PREVIEW_LAYOUTS.COLUMN,
43+
},
44+
{
45+
content: (
46+
<div className="flex min-w-12 flex-col items-center text-xs">
47+
{' '}
48+
<Icon icon="lucide:layout-dashboard" /> Flex
49+
</div>
50+
),
51+
srContent: 'Flex Layout',
52+
onClick: () => handleLayout(PREVIEW_LAYOUTS.FLEX),
53+
isActive: layout === PREVIEW_LAYOUTS.FLEX,
54+
},
55+
{
56+
content: (
57+
<div className="flex flex-col items-center text-xs">
58+
{' '}
59+
<Icon icon="bx:bx-grid-alt" /> Masonry
60+
</div>
61+
),
62+
srContent: 'Masonry Layout',
63+
onClick: () => handleLayout(PREVIEW_LAYOUTS.MASONRY),
64+
isActive: layout === PREVIEW_LAYOUTS.MASONRY,
65+
},
66+
]}
3667
/>
37-
<Icon icon="lucide:layout-dashboard" />
3868
</div>
3969
</div>
4070
);
4171
};
4272

43-
export default PreviewLayout;
73+
export default PreviewLayoutSelector;

desktop-app/src/renderer/components/ToolBar/Menu/Flyout/Settings/SettingsContentHeaders.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export const SettingsContentHeaders: FC<ISettingsContentHeaders> = ({
2929
/>
3030
</label>
3131
<p className="text-sm text-gray-500 dark:text-gray-400">
32-
HTTP request Accept-Language parameter
32+
HTTP request Accept-Language parameter (default: language from OS
33+
locale settings)
3334
</p>
3435
</div>
3536
</div>

0 commit comments

Comments
 (0)