Skip to content

Commit

Permalink
Merge branch 'dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban authored Oct 16, 2024
2 parents 03b7eec + a079d85 commit de58649
Show file tree
Hide file tree
Showing 51 changed files with 3,471 additions and 3,147 deletions.
18 changes: 9 additions & 9 deletions apps/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,31 @@
"@eneris/push-receiver": "4.2.0",
"@follow/shared": "workspace:*",
"@mozilla/readability": "^0.5.0",
"@sentry/electron": "5.4.0",
"builder-util-runtime": "9.2.5",
"@sentry/electron": "5.6.0",
"builder-util-runtime": "9.2.10",
"dayjs": "1.11.13",
"dotenv": "16.4.5",
"electron-context-menu": "4.0.4",
"electron-log": "5.2.0",
"electron-squirrel-startup": "1.0.1",
"electron-updater": "^6.3.4",
"electron-updater": "^6.3.9",
"font-list": "1.5.1",
"i18next": "^23.15.1",
"i18next": "^23.16.0",
"linkedom": "^0.18.5",
"lodash-es": "4.17.21",
"lowdb": "7.0.1",
"msedge-tts": "1.3.4",
"nanoid": "5.0.7",
"ofetch": "1.4.0",
"posthog-js": "1.165.0",
"posthog-node": "4.2.0",
"ofetch": "1.4.1",
"posthog-js": "1.169.0",
"posthog-node": "4.2.1",
"semver": "7.6.3",
"vscode-languagedetection": "npm:@vscode/vscode-languagedetection@^1.0.22"
},
"devDependencies": {
"@types/lodash-es": "4.17.12",
"@types/node": "^22.7.4",
"electron": "32.1.2",
"@types/node": "^22.7.5",
"electron": "33.0.0",
"electron-devtools-installer": "3.2.0",
"hono": "4.6.3"
}
Expand Down
90 changes: 45 additions & 45 deletions apps/renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@
"@follow/electron-main": "workspace:*",
"@follow/shared": "workspace:*",
"@fontsource/sn-pro": "5.1.0",
"@headlessui/react": "2.1.8",
"@hono/auth-js": "1.0.10",
"@headlessui/react": "2.1.10",
"@hono/auth-js": "1.0.11",
"@hookform/resolvers": "3.9.0",
"@iconify/tools": "4.0.7",
"@lottiefiles/dotlottie-react": "0.9.0",
"@lottiefiles/dotlottie-react": "0.9.1",
"@microflash/remark-callout-directives": "4.3.1",
"@mozilla/readability": "^0.5.0",
"@radix-ui/react-avatar": "1.1.0",
"@radix-ui/react-checkbox": "1.1.1",
"@radix-ui/react-context-menu": "2.2.1",
"@radix-ui/react-dialog": "1.1.1",
"@radix-ui/react-dropdown-menu": "2.1.1",
"@radix-ui/react-hover-card": "1.1.1",
"@radix-ui/react-avatar": "1.1.1",
"@radix-ui/react-checkbox": "1.1.2",
"@radix-ui/react-context-menu": "2.2.2",
"@radix-ui/react-dialog": "1.1.2",
"@radix-ui/react-dropdown-menu": "2.1.2",
"@radix-ui/react-hover-card": "1.1.2",
"@radix-ui/react-label": "2.1.0",
"@radix-ui/react-popover": "1.1.1",
"@radix-ui/react-radio-group": "1.2.0",
"@radix-ui/react-scroll-area": "1.1.0",
"@radix-ui/react-select": "2.1.1",
"@radix-ui/react-slider": "^1.2.0",
"@radix-ui/react-popover": "1.1.2",
"@radix-ui/react-radio-group": "1.2.1",
"@radix-ui/react-scroll-area": "1.2.0",
"@radix-ui/react-select": "2.1.2",
"@radix-ui/react-slider": "^1.2.1",
"@radix-ui/react-slot": "1.1.0",
"@radix-ui/react-switch": "1.1.0",
"@radix-ui/react-tabs": "1.1.0",
"@radix-ui/react-toast": "1.2.1",
"@radix-ui/react-tooltip": "1.1.2",
"@sentry/react": "8.32.0",
"@shikijs/transformers": "1.20.0",
"@radix-ui/react-switch": "1.1.1",
"@radix-ui/react-tabs": "1.1.1",
"@radix-ui/react-toast": "1.2.2",
"@radix-ui/react-tooltip": "1.1.3",
"@sentry/react": "8.34.0",
"@shikijs/transformers": "1.22.0",
"@t3-oss/env-core": "^0.11.1",
"@tanstack/query-sync-storage-persister": "5.56.2",
"@tanstack/react-query": "5.56.2",
"@tanstack/react-query-devtools": "5.58.0",
"@tanstack/react-query-persist-client": "5.56.2",
"@tanstack/query-sync-storage-persister": "5.59.13",
"@tanstack/react-query": "5.59.14",
"@tanstack/react-query-devtools": "5.59.14",
"@tanstack/react-query-persist-client": "5.59.14",
"@use-gesture/react": "10.3.1",
"@yornaath/batshit": "0.10.1",
"camelcase-keys": "9.1.3",
Expand All @@ -55,38 +55,38 @@
"dexie": "4.0.8",
"dnum": "^2.14.0",
"electron-log": "5.2.0",
"foxact": "0.2.38",
"framer-motion": "11.9.0",
"foxact": "0.2.39",
"framer-motion": "11.11.9",
"franc-min": "6.2.0",
"fuse.js": "7.0.0",
"hast-util-to-jsx-runtime": "2.3.0",
"hast-util-to-jsx-runtime": "2.3.2",
"hast-util-to-text": "4.0.2",
"i18next": "^23.15.1",
"i18next": "^23.16.0",
"i18next-browser-languagedetector": "8.0.0",
"idb-keyval": "6.2.1",
"immer": "10.1.1",
"jotai": "2.10.0",
"jotai": "2.10.1",
"katex": "0.16.11",
"lethargy": "1.0.9",
"lodash-es": "4.17.21",
"masonic": "4.0.1",
"nanoid": "5.0.7",
"ofetch": "1.4.0",
"ofetch": "1.4.1",
"path-to-regexp": "8.2.0",
"posthog-js": "1.165.0",
"posthog-js": "1.169.0",
"re-resizable": "6.10.0",
"react-blurhash": "^0.3.0",
"react-error-boundary": "4.0.13",
"react-fast-marquee": "1.6.5",
"react-hook-form": "7.53.0",
"react-hotkeys-hook": "4.5.1",
"react-i18next": "^15.0.2",
"react-i18next": "^15.0.3",
"react-intersection-observer": "9.13.1",
"react-resizable-layout": "npm:@innei/react-resizable-layout@0.7.3-fork.1",
"react-router-dom": "6.26.2",
"react-router-dom": "6.27.0",
"react-selecto": "1.26.3",
"react-shadow": "20.5.0",
"react-virtuoso": "4.10.4",
"react-virtuoso": "4.12.0",
"rehype-infer-description-meta": "2.0.0",
"rehype-parse": "9.0.1",
"rehype-sanitize": "6.0.0",
Expand All @@ -96,30 +96,30 @@
"remark-gh-alerts": "0.0.3",
"remark-parse": "11.0.0",
"remark-rehype": "11.1.1",
"shiki": "1.20.0",
"shiki": "1.22.0",
"sonner": "^1.5.0",
"swiper": "11.1.14",
"tailwind-merge": "2.5.2",
"tailwind-merge": "2.5.4",
"tailwindcss-motion": "0.3.0-beta",
"tldts": "6.1.48",
"tldts": "6.1.51",
"unified": "11.0.5",
"use-context-selector": "2.0.0",
"use-sync-external-store": "1.2.2",
"usehooks-ts": "3.1.0",
"vfile": "6.0.3",
"zod": "3.23.8",
"zustand": "4.5.5"
"zustand": "5.0.0"
},
"devDependencies": {
"@babel/generator": "7.25.6",
"@hono/node-server": "1.13.1",
"@babel/generator": "7.25.7",
"@hono/node-server": "1.13.2",
"@types/katex": "0.16.7",
"@types/lodash-es": "4.17.12",
"@types/node": "^22.7.4",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"@types/node": "^22.7.5",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"fake-indexeddb": "6.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"vitest": "2.0"
"react-dom": "^18.3.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Combobox, ComboboxInput, ComboboxOption, ComboboxOptions } from "@headlessui/react"
import { AnimatePresence, m } from "framer-motion"
import Fuse from "fuse.js"
import { forwardRef, Fragment, useCallback, useEffect, useState } from "react"
import { forwardRef, useCallback, useEffect, useState } from "react"

import { cn } from "~/lib/utils"

import { Input } from "../input"
import { useCorrectZIndex } from "../modal"

export type Suggestion = {
name: string
Expand All @@ -17,8 +18,6 @@ export interface AutocompleteProps extends React.InputHTMLAttributes<HTMLInputEl

onSuggestionSelected: (suggestion: NoInfer<Suggestion> | null) => void

portal?: boolean

// classnames

searchKeys?: string[]
Expand All @@ -34,7 +33,6 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
renderSuggestion = defaultRenderSuggestion,
onSuggestionSelected,
maxHeight,
portal,
value,
searchKeys = defaultSearchKeys,
defaultValue,
Expand Down Expand Up @@ -65,6 +63,7 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
doFilter()
}, [doFilter])

const zIndex = useCorrectZIndex(9)
return (
<Combobox
immediate
Expand All @@ -76,7 +75,7 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
>
{({ open }) => {
return (
<Fragment>
<div className="relative">
<ComboboxInput
ref={forwardedRef}
as={Input}
Expand All @@ -89,17 +88,18 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
<AnimatePresence>
{open && (
<ComboboxOptions
portal={portal}
portal={false}
static
as={m.div}
initial={{ opacity: 0, scale: 0.98 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.98 }}
anchor="bottom"
style={{ zIndex }}
className={cn(
"pointer-events-auto z-[99] max-h-48 grow",
"pointer-events-auto max-h-48 grow",
"shadow-perfect overflow-auto rounded-md border border-border bg-popover text-popover-foreground",
"w-[var(--input-width)] empty:invisible",
"absolute inset-x-0 top-[110%]",
)}
>
<div style={{ maxHeight }}>
Expand All @@ -119,7 +119,7 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
</ComboboxOptions>
)}
</AnimatePresence>
</Fragment>
</div>
)
}}
</Combobox>
Expand Down
2 changes: 2 additions & 0 deletions apps/renderer/src/components/ui/modal/stacked/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const defaultCtxValue: CurrentModalContentProps = {
dismiss: warnNoProvider,
setClickOutSideToDismiss: warnNoProvider,
ref: { current: null },
getIndex: () => 0,
}

export const CurrentModalContext = reactCreateContext<CurrentModalContentProps>(defaultCtxValue)
Expand All @@ -30,4 +31,5 @@ export type ModalContentComponent<T = object> = FC<ModalActionsInternal & T>
export type ModalActionsInternal = {
dismiss: () => void
setClickOutSideToDismiss: (value: boolean) => void
getIndex: () => number
}
19 changes: 18 additions & 1 deletion apps/renderer/src/components/ui/modal/stacked/hooks.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { DragControls } from "framer-motion"
import { useAtomValue } from "jotai"
import { selectAtom } from "jotai/utils"
import type { ResizeCallback, ResizeStartCallback } from "re-resizable"
import { useCallback, useContext, useId, useRef, useState } from "react"
import { useCallback, useContext, useId, useMemo, useRef, useState } from "react"
import { flushSync } from "react-dom"
import { useContextSelector } from "use-context-selector"
import { useEventCallback } from "usehooks-ts"
Expand All @@ -9,6 +11,7 @@ import { getUISettings } from "~/atoms/settings/ui"
import { jotaiStore } from "~/lib/jotai"

import { modalStackAtom } from "./atom"
import { MODAL_STACK_Z_INDEX } from "./constants"
import { CurrentModalContext, CurrentModalStateContext } from "./context"
import type { ModalProps, ModalStackOptions } from "./types"

Expand Down Expand Up @@ -150,3 +153,17 @@ export const useResizeableModal = (
}

export const useIsTopModal = () => useContextSelector(CurrentModalStateContext, (v) => v.isTop)

export const useCorrectZIndex = (fallbackZIndex = 0) => {
const inModal = useCurrentModal()

return useAtomValue(
useMemo(
() =>
selectAtom(modalStackAtom, (v) =>
inModal ? v.length + MODAL_STACK_Z_INDEX + inModal.getIndex() + 1 : fallbackZIndex,
),
[fallbackZIndex, inModal],
),
)
}
11 changes: 7 additions & 4 deletions apps/renderer/src/components/ui/modal/stacked/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,12 @@ export const ModalInternal = memo(

const { noticeModal, animateController } = useModalAnimate(!!isTop)

const getIndex = useEventCallback(() => index)
const modalContentRef = useRef<HTMLDivElement>(null)
const ModalProps: ModalActionsInternal = useMemo(
() => ({
dismiss: close,
getIndex,
setClickOutSideToDismiss: (v) => {
setStack((state) =>
produce(state, (draft) => {
Expand All @@ -146,7 +148,7 @@ export const ModalInternal = memo(
)
},
}),
[close, item.id, setStack],
[close, getIndex, item.id, setStack],
)

const ModalContextProps = useMemo<CurrentModalContentProps>(
Expand Down Expand Up @@ -210,10 +212,11 @@ export const ModalInternal = memo(
}, [])

useImperativeHandle(ref, () => modalElementRef.current!)
const currentModalZIndex = MODAL_STACK_Z_INDEX + index * 2

const Overlay = (
<ModalOverlay
zIndex={MODAL_STACK_Z_INDEX - 1}
zIndex={currentModalZIndex - 1}
blur={overlayOptions?.blur}
hidden={
item.overlay ? currentIsClosing : !(modalSettingOverlay && isBottom) || currentIsClosing
Expand All @@ -240,7 +243,7 @@ export const ModalInternal = memo(
modalContainerClassName,
)}
style={{
zIndex: MODAL_STACK_Z_INDEX + index,
zIndex: currentModalZIndex,
}}
onPointerUp={handleDetectSelectEnd}
onClick={handleClickOutsideToDismiss}
Expand Down Expand Up @@ -287,7 +290,7 @@ export const ModalInternal = memo(
onPointerUp={handleDetectSelectEnd}
onClick={handleClickOutsideToDismiss}
style={{
zIndex: MODAL_STACK_Z_INDEX + index,
zIndex: currentModalZIndex,
}}
>
{DragBar}
Expand Down
4 changes: 4 additions & 0 deletions apps/renderer/src/models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export type CombinedEntryModel = EntriesResponse[number] & {
}
}
export type EntryModel = CombinedEntryModel["entries"]
export type EntryModelSimple = Exclude<
ExtractBizResponse<typeof apiClient.feeds.$get>["data"]["entries"],
undefined
>[number]
export type DiscoverResponse = Array<
Exclude<ExtractBizResponse<typeof apiClient.discover.$post>["data"], undefined>[number]
>
Expand Down
Loading

0 comments on commit de58649

Please sign in to comment.