Skip to content

Commit

Permalink
Merge pull request #1311 from saiTharunDusa/master
Browse files Browse the repository at this point in the history
Fixed the issue #1206
  • Loading branch information
violetadev authored Sep 20, 2024
2 parents 78a44b2 + b04b96c commit 322e450
Show file tree
Hide file tree
Showing 9 changed files with 390 additions and 39 deletions.
104 changes: 102 additions & 2 deletions desktop-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions desktop-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.7",
"react-masonry-component": "^6.3.0",
"react-redux": "^8.0.5",
"react-router-dom": "^6.3.0",
"react-tabs": "^6.0.2",
Expand Down
4 changes: 2 additions & 2 deletions desktop-app/release/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions desktop-app/release/app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,11 @@ fs-extra@3.0.1:
jsonfile "^3.0.0"
universalify "^0.1.0"

fsevents@~2.3.2:
version "2.3.2"
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
Expand Down
1 change: 1 addition & 0 deletions desktop-app/src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const PREVIEW_LAYOUTS = {
COLUMN: 'COLUMN',
FLEX: 'FLEX',
INDIVIDUAL: 'INDIVIDUAL',
MASONRY: 'MASONRY',
} as const;

export type PreviewLayout =
Expand Down
44 changes: 44 additions & 0 deletions desktop-app/src/renderer/components/Masonry/MasonryLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';
import { Icon } from '@iconify/react';
import { PREVIEW_LAYOUTS } from 'common/constants';
import { useDispatch, useSelector } from 'react-redux';
import useKeyboardShortcut, {
SHORTCUT_CHANNEL,
} from 'renderer/components/KeyboardShortcutsManager/useKeyboardShortcut';
import Toggle from 'renderer/components/Toggle';
import { selectLayout, setLayout } from 'renderer/store/features/renderer';

const MasonryLayout = () => {
const layout = useSelector(selectLayout);
const dispatch = useDispatch();

const handleLayout = () => {
if (layout === PREVIEW_LAYOUTS.MASONRY)
dispatch(setLayout(PREVIEW_LAYOUTS.FLEX));
else dispatch(setLayout(PREVIEW_LAYOUTS.MASONRY));
};

useKeyboardShortcut(SHORTCUT_CHANNEL.PREVIEW_LAYOUT, handleLayout);

return (
<div className="flex flex-row items-center justify-start px-4">
<span className="w-1/2">Masonry Layout</span>
<div className="flex w-fit items-center gap-3 border-l px-5 dark:border-slate-400">
<Icon icon="mdi:view-grid-outline" />
<Toggle
isOn={layout === PREVIEW_LAYOUTS.MASONRY}
onChange={(e) => {
if (e.target.checked) {
dispatch(setLayout(PREVIEW_LAYOUTS.MASONRY));
} else {
dispatch(setLayout(PREVIEW_LAYOUTS.COLUMN));
}
}}
/>
<Icon icon="mdi:view-masonry-outline" />
</div>
</div>
);
};

export default MasonryLayout;
Loading

0 comments on commit 322e450

Please sign in to comment.