Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: project block uploaded contents appear without refresh (#331)

Peter Chinman586dea0018ef
diff --git a/js/app/packages/app/component/EntityActionsMenuItems.tsx b/js/app/packages/app/component/EntityActionsMenuItems.tsx
index a2d5a8c753..afd23cfcfa 100644
--- a/js/app/packages/app/component/EntityActionsMenuItems.tsx
+++ b/js/app/packages/app/component/EntityActionsMenuItems.tsx
@@ -104,7 +104,7 @@ export const EntityActionsMenuItems = (props: EntityActionsMenuItemsProps) => {
/>
<Divider />
<MenuItemInner action="rename" label="Rename" />
- <MenuItemInner action="move_to_project" label="Move to Project" />
+ <MenuItemInner action="move_to_project" label="Move to folder" />
<MenuItemInner action="copy" label="Copy" />
<Divider />
<div class="text-failure-ink w-full">
diff --git a/js/app/packages/app/component/EntityModal/MoveToProjectView.tsx b/js/app/packages/app/component/EntityModal/MoveToProjectView.tsx
index 8bc640b329..2fb9729c24 100644
--- a/js/app/packages/app/component/EntityModal/MoveToProjectView.tsx
+++ b/js/app/packages/app/component/EntityModal/MoveToProjectView.tsx
@@ -392,7 +392,7 @@ export const MoveToProjectView = (props: {
return (
<div class="" ref={rootScopeId} tabindex={-1}>
- <EntityModalTitle title="Move to Project" />
+ <EntityModalTitle title="Move to folder" />
<div class="flex pb-2">
<div class="flex justify-between items-center gap-2">
<div class="flex items-center gap-1">
@@ -438,7 +438,7 @@ export const MoveToProjectView = (props: {
<div class="w-full h-fit suppress-css-brackets mb-3">
<input
type="text"
- placeholder="Search projects..."
+ placeholder="Search folders..."
value={searchQuery()}
onInput={(e) => setSearchQuery(e.currentTarget.value)}
class="w-full p-2 text-sm border-1 border-edge/20 bg-menu text-ink placeholder:text-ink-placeholder focus:outline-none selection:bg-ink selection:text-panel"
diff --git a/js/app/packages/app/component/Launcher.tsx b/js/app/packages/app/component/Launcher.tsx
index 694ced9c9b..0ca9843794 100644
--- a/js/app/packages/app/component/Launcher.tsx
+++ b/js/app/packages/app/component/Launcher.tsx
@@ -189,19 +189,19 @@ export const CREATABLE_BLOCKS: CreatableBlock[] = [
},
},
{
- label: 'Project',
+ label: 'Folder',
icon: () => <WideFolder />,
- description: 'Create project',
+ description: 'Create folder',
blockName: 'project',
hotkeyToken: TOKENS.create.project,
altHotkeyToken: TOKENS.create.projectNewSplit,
- hotkey: 'p',
+ hotkey: 'f',
keyDownHandler: () => {
createBlock({
blockName: 'project',
createFn: () => {
const createProject = useCreateProject();
- return createProject({ name: 'New Project' });
+ return createProject({ name: 'New Folder' });
},
shouldInsert: pressedKeys().has('opt'),
});
diff --git a/js/app/packages/app/component/SoupContext.tsx b/js/app/packages/app/component/SoupContext.tsx
index 3018977ed0..25fa68d2f6 100644
--- a/js/app/packages/app/component/SoupContext.tsx
+++ b/js/app/packages/app/component/SoupContext.tsx
@@ -538,7 +538,7 @@ export function createNavigationEntityListShortcut({
});
// ---------------------------------------------------------------------------
- // MOVE TO PROJECT
+ // MOVE TO FOLDER
// ---------------------------------------------------------------------------
actionRegistry.register(
'move_to_project',
@@ -574,8 +574,8 @@ export function createNavigationEntityListShortcut({
hotkeyToken: TOKENS.entity.action.moveToFolder,
description: () =>
viewData().selectedEntities.length > 1
- ? 'Move items to project'
- : 'Move item to project',
+ ? 'Move items to folder'
+ : 'Move item to folder',
condition: () =>
isViewingList() &&
actionRegistry.isActionEnabled(
diff --git a/js/app/packages/app/component/UnifiedListView.tsx b/js/app/packages/app/component/UnifiedListView.tsx
index 69d3678271..e8cb6a9504 100644
--- a/js/app/packages/app/component/UnifiedListView.tsx
+++ b/js/app/packages/app/component/UnifiedListView.tsx
@@ -1606,7 +1606,9 @@ const EntityTypeToggle = (props: {
})
}
>
- <span class="uppercase">{props.type}</span>
+ <span class="uppercase">
+ {props.type === 'project' ? 'folder' : props.type}
+ </span>
</ToggleButton>
);
};
diff --git a/js/app/packages/app/component/bulk-edit-entity/BulkMoveToProjectView.tsx b/js/app/packages/app/component/bulk-edit-entity/BulkMoveToProjectView.tsx
index fe26d6b2fc..3b094fba4c 100644
--- a/js/app/packages/app/component/bulk-edit-entity/BulkMoveToProjectView.tsx
+++ b/js/app/packages/app/component/bulk-edit-entity/BulkMoveToProjectView.tsx
@@ -352,7 +352,7 @@ export const BulkMoveToProjectView = (props: {
props.onFinish();
} catch (error) {
- console.error('Failed to move entities to project:', error);
+ console.error('Failed to move entities to folder:', error);
}
}
};
@@ -363,12 +363,12 @@ export const BulkMoveToProjectView = (props: {
return (
<div ref={rootScopeId}>
<BulkEditEntityModalTitle
- title={`Move ${entityCount()} ${entityText()} to project`}
+ title={`Move ${entityCount()} ${entityText()} to folder`}
/>
<div class="mb-4">
<input
type="text"
- placeholder="Search projects..."
+ placeholder="Search folders..."
value={searchQuery()}
onInput={(e) => setSearchQuery(e.target.value)}
class="w-full px-3 py-2 border border-edge bg-menu text-ink focus:outline-none focus:border-accent"
diff --git a/js/app/packages/block-project/component/Block.tsx b/js/app/packages/block-project/component/Block.tsx
index 91ff7b27bc..3e75f268e4 100644
--- a/js/app/packages/block-project/component/Block.tsx
+++ b/js/app/packages/block-project/component/Block.tsx
@@ -12,6 +12,10 @@ import {
type UploadInput,
uploadFiles,
} from '@core/util/upload';
+import {
+ queryKeys,
+ useQueryClient as useEntityQueryClient,
+} from '@macro-entity';
import Files from '@phosphor-icons/core/duotone/files-duotone.svg?component-solid';
import { refetchResources } from '@service-storage/util/refetchResources';
import { toast } from 'core/component/Toast/Toast';
@@ -35,6 +39,7 @@ const Block: Component = () => {
const projectId = useBlockId();
const isSpecialProject = getIsSpecialProject(projectId);
const name = () => projectBlockDataSignal()?.projectMetadata.name;
+ const entityQueryClient = useEntityQueryClient();
const handleFileUpload = async (files: UploadInput[]) => {
if (files.length === 0) return;
@@ -55,6 +60,9 @@ const Block: Component = () => {
// show documents that were immediately uploaded
const successfulUploads = uploads.filter((result) => !result.pending);
if (successfulUploads.length > 0) {
+ entityQueryClient.invalidateQueries({
+ queryKey: queryKeys.all.dss,
+ });
refetchResources();
}
@@ -65,6 +73,9 @@ const Block: Component = () => {
.map((result) => result.projectId);
if (pendingFolderUploads.length > 0) {
await Promise.all(pendingFolderUploads);
+ entityQueryClient.invalidateQueries({
+ queryKey: queryKeys.all.dss,
+ });
refetchResources();
}
} catch (error) {
diff --git a/js/app/packages/block-project/component/ProjectCreateMenu.tsx b/js/app/packages/block-project/component/ProjectCreateMenu.tsx
index 0e47fcc16c..b178b01a78 100644
--- a/js/app/packages/block-project/component/ProjectCreateMenu.tsx
+++ b/js/app/packages/block-project/component/ProjectCreateMenu.tsx
@@ -155,7 +155,7 @@ function MenuContent(props: { projectId: string }) {
}),
},
{
- label: 'Project',
+ label: 'Folder',
blockName: 'project' as BlockName,
hotkeyToken: TOKENS.create.project,
Icon: () => (
@@ -170,7 +170,7 @@ function MenuContent(props: { projectId: string }) {
name: 'New Project',
parentId: props.projectId,
});
- if (!result) throw new Error('Failed to create project');
+ if (!result) throw new Error('Failed to create folder');
return result;
},
}),
diff --git a/js/app/packages/core/component/EntityIcon.tsx b/js/app/packages/core/component/EntityIcon.tsx
index ea3a9518af..9ec518f37f 100644
--- a/js/app/packages/core/component/EntityIcon.tsx
+++ b/js/app/packages/core/component/EntityIcon.tsx
@@ -156,13 +156,13 @@ export const ENTITY_ICON_CONFIGS: Record<EntityWithValidIcon, IconConfig> = {
icon: Folder,
foreground: 'text-folder',
background: 'bg-folder-bg',
- prettyName: 'Project',
+ prettyName: 'Folder',
},
sharedProject: {
icon: FolderUser,
foreground: 'text-folder',
background: 'bg-folder-bg',
- prettyName: 'Shared Project',
+ prettyName: 'Shared Folder',
},
unknown: {
icon: File,
diff --git a/js/app/packages/core/component/TopBar/FileMenu.tsx b/js/app/packages/core/component/TopBar/FileMenu.tsx
index 766f791fdb..d90a165403 100644
--- a/js/app/packages/core/component/TopBar/FileMenu.tsx
+++ b/js/app/packages/core/component/TopBar/FileMenu.tsx
@@ -362,7 +362,7 @@ export function DocumentFileMenu(props: ParentProps<DocumentFileMenuProps>) {
documentId: props.documentId,
projectId,
});
- if (isErr(result)) return toast.failure('Unable to move file to project');
+ if (isErr(result)) return toast.failure('Unable to move file to folder');
refetch();
refetchResources();
diff --git a/js/app/packages/core/component/TopBar/ShareButton.tsx b/js/app/packages/core/component/TopBar/ShareButton.tsx
index 3ffb2c8117..7b7a395e7d 100644
--- a/js/app/packages/core/component/TopBar/ShareButton.tsx
+++ b/js/app/packages/core/component/TopBar/ShareButton.tsx
@@ -257,9 +257,9 @@ export function ShareModal(props: ShareModalProps) {
});
if (!isErr(result)) {
refetch();
- toast.success('Removed project access', 'Project no longer has access');
+ toast.success('Removed folder access');
} else {
- toast.alert('Failed to remove project access', 'Please try again');
+ toast.alert('Failed to remove folder access', 'Please try again');
console.error(result);
}
}
@@ -404,13 +404,13 @@ export function ShareModal(props: ShareModalProps) {
if (!isErr(result)) {
refetch();
toast.success(
- newIsPublic ? 'Made project public' : 'Made project private',
+ newIsPublic ? 'Made folder public' : 'Made folder private',
newIsPublic
- ? 'Anyone with the link can now view this project'
- : 'Only shared users can access this project'
+ ? 'Anyone with the link can now view this folder'
+ : 'Only shared users can access this folder'
);
} else {
- toast.alert('Failed to change project access', 'Please try again');
+ toast.alert('Failed to change folder access', 'Please try again');
console.error(result);
}
}
@@ -448,7 +448,7 @@ export function ShareModal(props: ShareModalProps) {
refetch();
toast.success('Updated public link sharing access level');
} else {
- toast.alert('Failed to change project access', 'Please try again');
+ toast.alert('Failed to change folder access', 'Please try again');
console.error(result);
}
}
diff --git a/js/app/packages/core/constant/PaywallState.tsx b/js/app/packages/core/constant/PaywallState.tsx
index 2ec3fad83c..24b0f6533e 100644
--- a/js/app/packages/core/constant/PaywallState.tsx
+++ b/js/app/packages/core/constant/PaywallState.tsx
@@ -18,7 +18,7 @@ export enum PaywallKey {
export const PaywallMessages: Record<PaywallKey, string> = {
[PaywallKey.PROJECT_LIMIT]:
- 'You have reached the project limit of your current plan. Please upgrade to continue.',
+ 'You have reached the folder limit of your current plan. Please upgrade to continue.',
[PaywallKey.FILE_LIMIT]:
'You have reached the file limit of your current plan. Please upgrade to continue.',
[PaywallKey.CHAT_LIMIT]:
diff --git a/js/app/packages/macro-entity/src/queries/project.ts b/js/app/packages/macro-entity/src/queries/project.ts
index 4c79d17dbd..7f84310601 100644
--- a/js/app/packages/macro-entity/src/queries/project.ts
+++ b/js/app/packages/macro-entity/src/queries/project.ts
@@ -88,7 +88,7 @@ const fetchProjectData = async (
// Check access level
if (projectPreview.access === 'no_access') {
- throw new Error(`No access to project ${projectId}`);
+ throw new Error(`No access to folder ${projectId}`);
}
if (projectPreview.access === 'does_not_exist') {