A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
desktop: stop unnecessary animations
Abdullah Atta5e7e91caf0bb
diff --git a/apps/web/src/app.jsx b/apps/web/src/app.jsxindex a1d43ebe1..f45eceffa 100644--- a/apps/web/src/app.jsx+++ b/apps/web/src/app.jsx@@ -95,7 +95,11 @@ function SuspenseLoader({ condition, props, component: Component, fallback }) {if (!condition) return fallback;return (- <Suspense fallback={fallback}>+ <Suspense+ fallback={+ import.meta.env.REACT_APP_PLATFORM === "desktop" ? null : fallback+ }+ ><Component {...props} /></Suspense>);diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsxindex 90adcf245..6be31668a 100644--- a/apps/web/src/components/editor/tiptap.tsx+++ b/apps/web/src/components/editor/tiptap.tsx@@ -185,6 +185,7 @@ function TipTap(props: TipTapProps) {autofocus: "start",onFocus,onCreate: ({ editor }) => {+ if (onLoad) onLoad();if (oldNonce.current !== nonce)editor.commands.focus("start", { scrollIntoView: true });oldNonce.current = nonce;@@ -201,7 +202,6 @@ function TipTap(props: TipTapProps) {}}});- if (onLoad) onLoad();editor.commands.refreshSearch();},onUpdate: ({ editor, transaction }) => {diff --git a/apps/web/src/components/list-container/index.tsx b/apps/web/src/components/list-container/index.tsxindex 38d865add..8d6eba39e 100644--- a/apps/web/src/components/list-container/index.tsx+++ b/apps/web/src/components/list-container/index.tsx@@ -36,8 +36,6 @@ import Announcements from "../announcements";import { ListLoader } from "../loaders/list-loader";import ScrollContainer from "../scroll-container";import { useKeyboardListNavigation } from "../../hooks/use-keyboard-list-navigation";-import { AnimatedFlex } from "../animated";-import { domAnimation, LazyMotion } from "framer-motion";export const CustomScrollbarsVirtualList = forwardRef<HTMLDivElement,@@ -128,149 +126,132 @@ function ListContainer(props: ListContainerProps) {const Component = ListProfiles[type];return (- <LazyMotion features={domAnimation} strict>- <Flex variant="columnFill">- {!props.items.length && props.placeholder ? (- <>- {header}- {props.isLoading ? (- <ListLoader />- ) : (- <Flex variant="columnCenterFill" data-test-id="list-placeholder">- {props.placeholder}- </Flex>- )}- </>- ) : (- <>- <AnimatedFlex- initial={{- opacity: 0,- scale: 0.98- }}- animate={{- opacity: 1,- scale: 1+ <Flex variant="columnFill">+ {!props.items.length && props.placeholder ? (+ <>+ {header}+ {props.isLoading ? (+ <ListLoader />+ ) : (+ <Flex variant="columnCenterFill" data-test-id="list-placeholder">+ {props.placeholder}+ </Flex>+ )}+ </>+ ) : (+ <>+ <Flex+ ref={listContainerRef}+ variant="columnFill"+ data-test-id={`${type}-list`}+ >+ <Virtuoso+ ref={listRef}+ data={items}+ computeItemKey={(index) => items[index].id || items[index].title}+ defaultItemHeight={DEFAULT_ITEM_HEIGHT}+ totalCount={items.length}+ onBlur={() => setFocusedGroupIndex(-1)}+ onKeyDown={(e) => onKeyDown(e.nativeEvent)}+ components={{+ Scroller: CustomScrollbarsVirtualList,+ Item: (props) => (+ <div+ {...props}+ style={{ paddingBottom: 1 }}+ onFocus={() => onFocus(props["data-item-index"])}+ onMouseDown={(e) =>+ onMouseDown(e.nativeEvent, props["data-item-index"])+ }+ >+ {props.children}+ </div>+ ),+ Header: () => (header ? header : <Announcements />)}}- transition={{ duration: 0.2, delay: 0.1, ease: "easeInOut" }}- ref={listContainerRef}- variant="columnFill"- data-test-id={`${type}-list`}- >- <Virtuoso- ref={listRef}- data={items}- computeItemKey={(index) =>- items[index].id || items[index].title- }- defaultItemHeight={DEFAULT_ITEM_HEIGHT}- totalCount={items.length}- onBlur={() => setFocusedGroupIndex(-1)}- onKeyDown={(e) => onKeyDown(e.nativeEvent)}- components={{- Scroller: CustomScrollbarsVirtualList,- Item: (props) => (- <div- {...props}- style={{ paddingBottom: 1 }}- onFocus={() => onFocus(props["data-item-index"])}- onMouseDown={(e) =>- onMouseDown(e.nativeEvent, props["data-item-index"])- }- >- {props.children}- </div>- ),- Header: () => (header ? header : <Announcements />)- }}- itemContent={(index, item) => {- if (!item) return null;+ itemContent={(index, item) => {+ if (!item) return null;- switch (item.type) {- case "header":- if (!groupType) return null;- return (- <GroupHeader- type={groupType}- refresh={refresh}- title={item.title}- isFocused={index === focusedGroupIndex}- index={index}- onSelectGroup={() => {- let endIndex;- for (- let i = index + 1;- i < props.items.length;- ++i- ) {- if (props.items[i].type === "header") {- endIndex = i;- break;- }+ switch (item.type) {+ case "header":+ if (!groupType) return null;+ return (+ <GroupHeader+ type={groupType}+ refresh={refresh}+ title={item.title}+ isFocused={index === focusedGroupIndex}+ index={index}+ onSelectGroup={() => {+ let endIndex;+ for (let i = index + 1; i < props.items.length; ++i) {+ if (props.items[i].type === "header") {+ endIndex = i;+ break;}- setSelectedItems([- ...selectionStore.get().selectedItems,- ...props.items.slice(- index,- endIndex || props.items.length- )- ]);- }}- groups={groups}- onJump={(title: string) => {- const index = props.items.findIndex(- (v) => v.title === title- );- if (index < 0) return;- listRef.current?.scrollToIndex({+ }+ setSelectedItems([+ ...selectionStore.get().selectedItems,+ ...props.items.slice(index,- align: "center",- behavior: "auto"- });- setFocusedGroupIndex(index);- }}- />- );- default:- return (- <Component- item={item}- context={context}- index={index}- type={type}- compact={compact}- />- );- }- }}- />- </AnimatedFlex>- </>- )}- {button && (- <Button- variant="primary"- data-test-id={`${props.type}-action-button`}- onClick={button.onClick}- sx={{- position: "absolute",- bottom: 0,- display: ["block", "block", "none"],- alignSelf: "end",- borderRadius: 100,- p: 0,- m: 0,- mb: 2,- mr: 2,- width: 45,- height: 45- }}- >- <Plus color="static" />- </Button>- )}- </Flex>- </LazyMotion>+ endIndex || props.items.length+ )+ ]);+ }}+ groups={groups}+ onJump={(title: string) => {+ const index = props.items.findIndex(+ (v) => v.title === title+ );+ if (index < 0) return;+ listRef.current?.scrollToIndex({+ index,+ align: "center",+ behavior: "auto"+ });+ setFocusedGroupIndex(index);+ }}+ />+ );+ default:+ return (+ <Component+ item={item}+ context={context}+ index={index}+ type={type}+ compact={compact}+ />+ );+ }+ }}+ />+ </Flex>+ </>+ )}+ {button && (+ <Button+ variant="primary"+ data-test-id={`${props.type}-action-button`}+ onClick={button.onClick}+ sx={{+ position: "absolute",+ bottom: 0,+ display: ["block", "block", "none"],+ alignSelf: "end",+ borderRadius: 100,+ p: 0,+ m: 0,+ mb: 2,+ mr: 2,+ width: 45,+ height: 45+ }}+ >+ <Plus color="static" />+ </Button>+ )}+ </Flex>);}export default ListContainer;diff --git a/apps/web/src/components/navigation-menu/index.tsx b/apps/web/src/components/navigation-menu/index.tsxindex 18ef8c598..82e12b5ac 100644--- a/apps/web/src/components/navigation-menu/index.tsx+++ b/apps/web/src/components/navigation-menu/index.tsx@@ -48,6 +48,7 @@ import { useStore as useUserStore } from "../../stores/user-store";import { useStore as useThemeStore } from "../../stores/theme-store";import useLocation from "../../hooks/use-location";import { FlexScrollContainer } from "../scroll-container";+import { isDesktop } from "../../utils/platform";type Route = {title: string;@@ -191,7 +192,7 @@ function NavigationMenu(props: NavigationMenuProps) {))}{colors.map((color, index) => (<NavigationItem- animate+ animate={!isDesktop()}index={index}isTablet={isTablet}key={color.id}@@ -220,7 +221,7 @@ function NavigationMenu(props: NavigationMenuProps) {/>{shortcuts.map((item, index) => (<NavigationItem- animate+ animate={!isDesktop()}index={colors.length - 1 + index}isTablet={isTablet}key={item.id}