Skip to content

feat: new revision history UI #861

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

Merged
merged 84 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
4997ddf
feat: add new icon
amanharwara Feb 2, 2022
ecee0a6
feat: add revision history modal
amanharwara Feb 2, 2022
275e00d
feat: add new utility classes
amanharwara Feb 2, 2022
dd633b4
feat: add note history option
amanharwara Feb 2, 2022
efb60bc
feat: add option to make note tags container readonly
amanharwara Feb 2, 2022
840526b
feat: forward ref to button component
amanharwara Feb 2, 2022
b9314a2
feat: add spinners when loading revision
amanharwara Feb 3, 2022
997726b
fix: revision history modal overflow
amanharwara Feb 3, 2022
8ce92f1
feat: add new utility classes
amanharwara Feb 3, 2022
69e7fb5
feat: add new utility classes
amanharwara Feb 3, 2022
263bdde
feat: check for revision before showing title and content
amanharwara Feb 3, 2022
f239297
feat: implement restore and restoreAsCopy functions
amanharwara Feb 3, 2022
d4625da
feat: add new constants
amanharwara Feb 3, 2022
4e7e3e7
feat: add function to calculate difference between dates
amanharwara Feb 3, 2022
fb563e0
feat: sort revision history into groups
amanharwara Feb 3, 2022
2cecbf3
feat: add new utility classes
amanharwara Feb 4, 2022
35a6f66
refactor: move history list & content into separate components
amanharwara Feb 4, 2022
7d38b4c
Merge branch 'develop' into feat/new-revision-history-ui
amanharwara Feb 4, 2022
30a9dd5
refactor: move history item and content to separate files
amanharwara Feb 4, 2022
ac40d62
refactor: move componentViewer cleanup to separate effect
amanharwara Feb 4, 2022
128b2ed
refactor: revert NoteTagsContainer to original
amanharwara Feb 4, 2022
f8dd185
feat: remove NoteTagsContainer from content
amanharwara Feb 4, 2022
38fdef6
Merge branch 'develop' into feat/new-revision-history-ui
amanharwara Feb 4, 2022
5509fe7
feat: remove ComponentViewer cleanup temporarily
amanharwara Feb 4, 2022
f4f2226
refactor: reduce unnecessary re-renders
amanharwara Feb 5, 2022
f1982dd
refactor: move RemoteHistoryList to separate file
amanharwara Feb 5, 2022
00533dc
refactor: Make revision list functions generic
amanharwara Feb 5, 2022
28dccde
refactor: consolidate listgroup funcs even more
amanharwara Feb 5, 2022
06139f7
feat: add tabs to revision history ui
amanharwara Feb 5, 2022
661a961
feat: add componentViewer cleanup
amanharwara Feb 5, 2022
632bf75
chore: bump stylekit version
amanharwara Feb 7, 2022
fdabd2b
chore: use new stylekit package name
amanharwara Feb 7, 2022
9a1e062
feat: add new utility classes
amanharwara Feb 7, 2022
623e91c
feat: use different classname
amanharwara Feb 7, 2022
8da2fef
chore: use new stylekit package name
amanharwara Feb 7, 2022
093e279
refactor: use useMemo instead of useState+useEffect combo
amanharwara Feb 7, 2022
dcb08e9
fix: first item of list not always being selected
amanharwara Feb 7, 2022
a76c897
feat: add loading spinner and "No revision selected" message
amanharwara Feb 7, 2022
66b0f95
feat: add more padding
amanharwara Feb 7, 2022
0a34bf1
feat: make both tabs selectable even if no history
amanharwara Feb 7, 2022
f8c8c9c
Merge branch 'develop' into feat/new-revision-history-ui
amanharwara Feb 8, 2022
f5f544d
Merge branch 'develop' into feat/new-revision-history-ui
amanharwara Feb 9, 2022
d221dde
feat: add new illustration
amanharwara Feb 9, 2022
8719f89
feat: add keyboard navigation to history lists
amanharwara Feb 9, 2022
38dea71
feat: add new utility classes
amanharwara Feb 9, 2022
5238165
feat: add revision content locked screen
amanharwara Feb 9, 2022
01c80f3
chore: bump snjs version
amanharwara Feb 10, 2022
9c39ee9
refactor: history list item to have any children
amanharwara Feb 10, 2022
28d719f
feat: show premium icon/message if user doesnt have role
amanharwara Feb 10, 2022
d4739ca
Merge branch 'develop' into feat/new-revision-history-ui
amanharwara Feb 10, 2022
75930c6
feat: show delete button for remote revisions
amanharwara Feb 11, 2022
0f02181
feat: update history list styles
amanharwara Feb 11, 2022
a47b720
refactor: move content placeholder to separate component
amanharwara Feb 11, 2022
d7de4e2
chore: bump snjs version
amanharwara Feb 11, 2022
c683818
feat: add new utility classes
amanharwara Feb 11, 2022
0ba5ee4
feat: allow components as button children
amanharwara Feb 11, 2022
e60721e
refactor: move remoteHistory and fetch outside of list container
amanharwara Feb 11, 2022
4a45baf
feat: make history list group title unselectable
amanharwara Feb 11, 2022
cb95a26
feat: implement delete version functionality
amanharwara Feb 11, 2022
2fe295e
feat: remove existing history menu
amanharwara Feb 11, 2022
0f12bd7
feat: focus selected item on container focus
amanharwara Feb 11, 2022
e92281f
feat: add support for legacy note history
amanharwara Feb 11, 2022
5386b22
Merge branch 'develop' into feat/new-revision-history-ui
amanharwara Feb 12, 2022
2916309
feat: change delete version button text
amanharwara Feb 12, 2022
091a8e1
feat: show remote tab by default
amanharwara Feb 12, 2022
af53fc2
fix: long plain note overflow issue
amanharwara Feb 12, 2022
8ff7f66
fix: remote history list keyboard nav
amanharwara Feb 12, 2022
4fc2328
feat: select restored note when copied
amanharwara Feb 14, 2022
a57d719
feat: remove unnecessary dependency
amanharwara Feb 14, 2022
5bfbf4f
refactor: better code readability
amanharwara Feb 14, 2022
3eb1734
chore: bump snjs version
amanharwara Feb 14, 2022
ec60133
feat: use hasMinimumRole function
amanharwara Feb 14, 2022
a406ad0
chore: bump snjs version
amanharwara Feb 14, 2022
fb1e318
feat: use ActionVerb enum
amanharwara Feb 14, 2022
05f7bcb
Merge branch 'develop' into feat/new-revision-history-ui
amanharwara Feb 15, 2022
0eae936
chore: update stylekit version
amanharwara Feb 15, 2022
2dd5958
feat: use icon from stylekit
amanharwara Feb 15, 2022
3e5ff54
feat: only check plan id if user has account
amanharwara Feb 15, 2022
88fad52
Merge branch 'develop' into feat/new-revision-history-ui
amanharwara Feb 15, 2022
c12ff0a
chore: update dependencies
amanharwara Feb 15, 2022
8539d3d
fix: revision premium content copy
amanharwara Feb 15, 2022
f34711f
chore: bump dependencies
amanharwara Feb 16, 2022
e071b37
Merge branch 'develop' into feat/new-revision-history-ui
amanharwara Feb 16, 2022
3b0276f
Merge branch 'develop' into feat/new-revision-history-ui
amanharwara Feb 16, 2022
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
6 changes: 6 additions & 0 deletions app/assets/javascripts/components/ApplicationView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { NotesContextMenu } from '@/components/NotesContextMenu';
import { PurchaseFlowWrapper } from '@/purchaseFlow/PurchaseFlowWrapper';
import { render } from 'preact';
import { PermissionsModal } from './PermissionsModal';
import { RevisionHistoryModalWrapper } from './RevisionHistoryModal/RevisionHistoryModalWrapper';
import { PremiumModalProvider } from './Premium';
import { ConfirmSignoutContainer } from './ConfirmSignoutModal';

Expand Down Expand Up @@ -239,6 +240,11 @@ export class ApplicationView extends PureComponent<Props, State> {
appState={this.appState}
application={this.application}
/>

<RevisionHistoryModalWrapper
application={this.application}
appState={this.appState}
/>
</>
)}

Expand Down
55 changes: 36 additions & 19 deletions app/assets/javascripts/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { JSXInternal } from 'preact/src/jsx';
import TargetedEvent = JSXInternal.TargetedEvent;
import TargetedMouseEvent = JSXInternal.TargetedMouseEvent;

import { FunctionComponent } from 'preact';
import { ComponentChildren, FunctionComponent, Ref } from 'preact';
import { forwardRef } from 'preact/compat';

const baseClass = `rounded px-4 py-1.75 font-bold text-sm fit-content`;

Expand All @@ -14,30 +15,46 @@ const buttonClasses: { [type in ButtonType]: string } = {
danger: `${baseClass} bg-default color-danger border-solid border-main border-1 focus:bg-contrast hover:bg-contrast`,
};

export const Button: FunctionComponent<{
type ButtonProps = {
children?: ComponentChildren;
className?: string;
type: ButtonType;
label: string;
label?: string;
onClick: (
event:
| TargetedEvent<HTMLFormElement>
| TargetedMouseEvent<HTMLButtonElement>
) => void;
disabled?: boolean;
}> = ({ type, label, className = '', onClick, disabled = false }) => {
const buttonClass = buttonClasses[type];
const cursorClass = disabled ? 'cursor-default' : 'cursor-pointer';

return (
<button
className={`${buttonClass} ${cursorClass} ${className}`}
onClick={(e) => {
onClick(e);
e.preventDefault();
}}
disabled={disabled}
>
{label}
</button>
);
};

export const Button: FunctionComponent<ButtonProps> = forwardRef(
(
{
type,
label,
className = '',
onClick,
disabled = false,
children,
}: ButtonProps,
ref: Ref<HTMLButtonElement>
) => {
const buttonClass = buttonClasses[type];
const cursorClass = disabled ? 'cursor-default' : 'cursor-pointer';

return (
<button
className={`${buttonClass} ${cursorClass} ${className}`}
onClick={(e) => {
onClick(e);
e.preventDefault();
}}
disabled={disabled}
ref={ref}
>
{label ?? children}
</button>
);
}
);
Loading