Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 05ae423

Browse files
authored
Merge pull request #449 from reorproject/file-explorer-improvements
initial changes for context menu fix
2 parents b1f4697 + 27f4af9 commit 05ae423

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1207
-1295
lines changed

electron/main/electron-store/storeConfig.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,15 @@ export type EmbeddingModelConfig = EmbeddingModelWithRepo | EmbeddingModelWithLo
2525
export interface EmbeddingModelWithRepo {
2626
type: 'repo'
2727
repoName: string
28+
description?: string
29+
readableName?: string
2830
}
2931

3032
export interface EmbeddingModelWithLocalPath {
3133
type: 'local'
3234
localPath: string
33-
}
34-
35-
export type Tab = {
36-
id: string // Unique ID for the tab, useful for operations
37-
path: string // Path to the content open in the tab
38-
title: string // Title of the tab
39-
lastAccessed: boolean
40-
// timeOpened: Date; // Timestamp to preserve order
41-
// isDirty: boolean; // Flag to indicate unsaved changes
35+
description?: string
36+
readableName?: string
4237
}
4338

4439
export interface StoreSchema {
@@ -65,7 +60,6 @@ export interface StoreSchema {
6560
isSBCompact: boolean
6661
spellCheck: string
6762
EditorFlexCenter: boolean
68-
OpenTabs: Tab[]
6963
showDocumentStats: boolean
7064
}
7165

@@ -87,6 +81,5 @@ export enum StoreKeys {
8781
IsSBCompact = 'isSBCompact',
8882
SpellCheck = 'spellCheck',
8983
EditorFlexCenter = 'editorFlexCenter',
90-
OpenTabs = 'OpenTabs',
9184
showDocumentStats = 'showDocumentStats',
9285
}

electron/main/vector-database/embeddings.ts

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,36 @@ import { splitDirectoryPathIntoBaseAndRepo } from '../filesystem/filesystem'
1515
import DownloadModelFilesFromHFRepo from './downloadModelsFromHF'
1616
import { DBEntry } from './schema'
1717

18-
export const defaultEmbeddingModelRepos = {
19-
'Xenova/UAE-Large-V1': { type: 'repo', repoName: 'Xenova/UAE-Large-V1' },
20-
'Xenova/bge-base-en-v1.5': {
18+
export const defaultEmbeddingModelRepos: Record<string, EmbeddingModelConfig> = {
19+
'Xenova/UAE-Large-V1': {
2120
type: 'repo',
22-
repoName: 'Xenova/bge-base-en-v1.5',
21+
repoName: 'Xenova/UAE-Large-V1',
22+
readableName: 'UAE-Large-V1',
23+
description: 'Recommended for English content',
2324
},
2425
'Xenova/bge-small-en-v1.5': {
2526
type: 'repo',
2627
repoName: 'Xenova/bge-small-en-v1.5',
28+
readableName: 'bge-small-en-v1.5',
29+
description: 'Recommended for low-power devices',
30+
},
31+
'Xenova/multilingual-e5-large': {
32+
type: 'repo',
33+
repoName: 'Xenova/multilingual-e5-large',
34+
readableName: 'multilingual-e5-large',
35+
description: 'Recommended for non-English content',
36+
},
37+
'Xenova/jina-embeddings-v2-base-zh': {
38+
type: 'repo',
39+
repoName: 'Xenova/jina-embeddings-v2-base-zh',
40+
readableName: 'jina-embeddings-v2-base-zh',
41+
description: 'Recommended for Chinese content',
42+
},
43+
'Xenova/jina-embeddings-v2-base-de': {
44+
type: 'repo',
45+
repoName: 'Xenova/jina-embeddings-v2-base-de',
46+
readableName: 'jina-embeddings-v2-base-de',
47+
description: 'Recommended for German content',
2748
},
2849
}
2950

package-lock.json

Lines changed: 133 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,20 @@
4444
"@radix-ui/colors": "^3.0.0",
4545
"@radix-ui/react-checkbox": "^1.1.1",
4646
"@radix-ui/react-collapsible": "^1.1.0",
47+
"@radix-ui/react-context-menu": "^2.2.2",
4748
"@radix-ui/react-dialog": "^1.1.1",
4849
"@radix-ui/react-dropdown-menu": "^2.1.2",
4950
"@radix-ui/react-hover-card": "^1.1.1",
5051
"@radix-ui/react-icons": "^1.3.0",
5152
"@radix-ui/react-label": "^2.1.0",
5253
"@radix-ui/react-popover": "^1.1.1",
54+
"@radix-ui/react-progress": "^1.1.0",
5355
"@radix-ui/react-scroll-area": "^1.2.0",
5456
"@radix-ui/react-select": "^2.1.1",
5557
"@radix-ui/react-slider": "^1.2.0",
5658
"@radix-ui/react-slot": "^1.1.0",
5759
"@radix-ui/react-switch": "^1.1.0",
60+
"@radix-ui/react-tabs": "^1.1.1",
5861
"@radix-ui/react-tooltip": "^1.1.3",
5962
"@sentry/electron": "^5.3.0",
6063
"@tailwindcss/typography": "^0.5.10",

src/components/Common/CommonModals.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from 'react'
22

33
import { useModalOpeners } from '@/contexts/ModalContext'
4-
import NewDirectoryComponent from '../File/NewDirectory'
54
import SettingsModal from '../Settings/Settings'
65
import FlashcardMenuModal from '../Flashcard/FlashcardMenuModal'
76
import { useFileContext } from '@/contexts/FileContext'
87
import RenameNoteModal from '../File/RenameNote'
98
import RenameDirModal from '../File/RenameDirectory'
9+
import NewDirectoryComponent from '../File/NewDirectory'
1010

1111
const CommonModals: React.FC = () => {
1212
const {
@@ -26,7 +26,7 @@ const CommonModals: React.FC = () => {
2626

2727
return (
2828
<div>
29-
<NewDirectoryComponent isOpen={isNewDirectoryModalOpen} onClose={() => setIsNewDirectoryModalOpen(false)} />
29+
<NewDirectoryComponent isOpen={isNewDirectoryModalOpen} onClose={() => setIsNewDirectoryModalOpen(false)} />{' '}
3030
{noteToBeRenamed && <RenameNoteModal />}
3131
{fileDirToBeRenamed && <RenameDirModal />}
3232
<SettingsModal isOpen={isSettingsModalOpen} onClose={() => setIsSettingsModalOpen(false)} />

src/components/Common/EmptyPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const EmptyPage: React.FC = () => {
1717
<div className="m-0 flex max-w-md flex-col gap-2">
1818
<button
1919
className="cursor-pointer border-0 bg-transparent pb-1 pr-0 text-left text-2lg text-blue-500"
20-
onClick={createUntitledNote}
20+
onClick={() => createUntitledNote()}
2121
type="button"
2222
>
2323
Create a File

src/components/Common/Modal.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useRef, useEffect } from 'react'
2+
import ReactDOM from 'react-dom'
23

34
interface ModalProps {
45
isOpen: boolean
@@ -33,9 +34,9 @@ const ReorModal: React.FC<ModalProps> = ({
3334
return null
3435
}
3536

36-
return (
37+
const modalContent = (
3738
<div
38-
className={`fixed inset-0 z-50 flex h-full items-center justify-center bg-black/40 ${tailwindStylesOnBackground}`}
39+
className={`fixed inset-0 flex h-screen w-screen items-center justify-center bg-black/40 ${tailwindStylesOnBackground}`}
3940
>
4041
<div
4142
ref={modalRef}
@@ -58,6 +59,8 @@ const ReorModal: React.FC<ModalProps> = ({
5859
</div>
5960
</div>
6061
)
62+
63+
return ReactDOM.createPortal(modalContent, document.body)
6164
}
6265

6366
export default ReorModal

src/components/File/NewDirectory.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import { useFileContext } from '@/contexts/FileContext'
1010
interface NewDirectoryComponentProps {
1111
isOpen: boolean
1212
onClose: () => void
13+
parentDirectoryPath?: string
1314
}
1415

15-
const NewDirectoryComponent: React.FC<NewDirectoryComponentProps> = ({ isOpen, onClose }) => {
16+
const NewDirectoryComponent: React.FC<NewDirectoryComponentProps> = ({ isOpen, onClose, parentDirectoryPath }) => {
1617
const [directoryName, setDirectoryName] = useState<string>('')
1718
const [errorMessage, setErrorMessage] = useState<string | null>(null)
1819

@@ -45,10 +46,16 @@ const NewDirectoryComponent: React.FC<NewDirectoryComponentProps> = ({ isOpen, o
4546
const validName = await handleValidName(directoryName)
4647
if (!directoryName || errorMessage || !validName) return
4748

48-
const directoryPath =
49-
currentlyOpenFilePath === '' || currentlyOpenFilePath === null
50-
? await window.electronStore.getVaultDirectoryForWindow()
51-
: await window.path.dirname(currentlyOpenFilePath as string)
49+
let directoryPath: string
50+
51+
if (parentDirectoryPath) {
52+
directoryPath = parentDirectoryPath
53+
} else if (currentlyOpenFilePath && currentlyOpenFilePath !== '') {
54+
directoryPath = await window.path.dirname(currentlyOpenFilePath)
55+
} else {
56+
directoryPath = await window.electronStore.getVaultDirectoryForWindow()
57+
}
58+
5259
const finalPath = await window.path.join(directoryPath, directoryName)
5360
window.fileSystem.createDirectory(finalPath)
5461
posthog.capture('created_new_directory_from_new_directory_modal')
@@ -70,6 +77,8 @@ const NewDirectoryComponent: React.FC<NewDirectoryComponentProps> = ({ isOpen, o
7077
}
7178
}}
7279
placeholder="Directory Name"
80+
// eslint-disable-next-line jsx-a11y/no-autofocus
81+
autoFocus
7382
/>
7483

7584
<div className="flex items-center gap-3">

src/components/Settings/AnalyticsSettings.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ const AnalyticsSettings: React.FC<AnalyticsSettingsProps> = () => {
3434
<div className="w-full rounded bg-dark-gray-c-three pb-7 ">
3535
<h2 className="mb-0 text-2xl font-semibold text-white">Analytics</h2>{' '}
3636
<p className="mb-2 mt-5 text-sm text-gray-200">
37-
Reor tracks anonymous usage data to help improve the app. We never share this personal data. This is solely to
38-
track which features are popular. You can disable this at any time:
37+
Reor tracks anonymous usage data to help us understand how the app is used and which features are popular. You
38+
can disable this at any time:
3939
</p>
4040
<Switch
4141
checked={isAnalyticsEnabled}

0 commit comments

Comments
 (0)