Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/canary' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed May 7, 2024
2 parents d9ad3ca + d76a635 commit cff3eb7
Show file tree
Hide file tree
Showing 18 changed files with 260 additions and 438 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@faker-js/faker": "^8.4.1",
"@istanbuljs/schema": "^0.1.3",
"@magic-works/i18n-codegen": "^0.5.0",
"@nx/vite": "18.2.4",
"@nx/vite": "19.0.0",
"@playwright/test": "^1.43.0",
"@taplo/cli": "^0.7.0",
"@testing-library/react": "^15.0.0",
Expand Down Expand Up @@ -93,7 +93,7 @@
"lint-staged": "^15.2.2",
"msw": "^2.2.13",
"nanoid": "^5.0.7",
"nx": "^18.2.4",
"nx": "^19.0.0",
"nyc": "^15.1.0",
"oxlint": "0.3.1",
"prettier": "^3.2.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"devDependencies": {
"@napi-rs/cli": "3.0.0-alpha.46",
"lib0": "^0.2.93",
"nx": "^18.2.4",
"nx": "^19.0.0",
"nx-cloud": "^18.0.0",
"yjs": "^13.6.14"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/common/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"private": true,
"type": "module",
"devDependencies": {
"@blocksuite/global": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/store": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/global": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/store": "0.14.0-canary-202405070334-778ff10",
"react": "18.2.0",
"react-dom": "18.2.0",
"vitest": "1.4.0"
Expand Down
10 changes: 5 additions & 5 deletions packages/common/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"@affine/debug": "workspace:*",
"@affine/env": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/blocks": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/global": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/store": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/blocks": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/global": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/store": "0.14.0-canary-202405070334-778ff10",
"@datastructures-js/binary-search-tree": "^5.3.2",
"foxact": "^0.2.33",
"jotai": "^2.8.0",
Expand All @@ -28,8 +28,8 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/block-std": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/presets": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/block-std": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/presets": "0.14.0-canary-202405070334-778ff10",
"@testing-library/react": "^15.0.0",
"async-call-rpc": "^6.4.0",
"react": "^18.2.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/frontend/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@blocksuite/block-std": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/blocks": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/global": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/block-std": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/blocks": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/global": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/icons": "2.1.46",
"@blocksuite/presets": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/store": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/presets": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/store": "0.14.0-canary-202405070334-778ff10",
"@storybook/addon-actions": "^7.6.17",
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-interactions": "^7.6.17",
Expand Down
12 changes: 6 additions & 6 deletions packages/frontend/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
"@affine/graphql": "workspace:*",
"@affine/i18n": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/block-std": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/blocks": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/global": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/block-std": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/blocks": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/global": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/icons": "2.1.46",
"@blocksuite/inline": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/presets": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/store": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/inline": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/presets": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/store": "0.14.0-canary-202405070334-778ff10",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/modifiers": "^7.0.0",
"@dnd-kit/sortable": "^8.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cssVar } from '@toeverything/theme';
import { keyframes, style } from '@vanilla-extract/css';
import { globalStyle, keyframes, style } from '@vanilla-extract/css';
export const plansLayoutRoot = style({
display: 'flex',
flexDirection: 'column',
Expand Down Expand Up @@ -100,7 +100,6 @@ export const aiScrollTip = style({
justifyContent: 'space-between',
padding: '12px 20px 12px 16px',
boxShadow: cssVar('shadow1'),
display: 'flex',
marginBottom: -100,

animation: `${slideInBottom} 0.3s ease 0.5s forwards`,
Expand All @@ -112,6 +111,10 @@ export const aiScrollTip = style({
},
},
});
// to override `display: contents !important` in `scrollable.tsx`
globalStyle(`div.${aiScrollTip}`, {
display: 'flex !important',
});
export const aiScrollTipLabel = style({
display: 'flex',
alignItems: 'center',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Loading } from '@affine/component';
import { Loading, Scrollable } from '@affine/component';
import { WorkspaceDetailSkeleton } from '@affine/component/setting-components';
import type { ModalProps } from '@affine/component/ui/modal';
import { Modal } from '@affine/component/ui/modal';
Expand Down Expand Up @@ -139,51 +139,54 @@ const SettingModalInner = ({
onTabChange={onTabChange}
selectedWorkspaceId={workspaceMetadata?.id ?? null}
/>
<div
data-testid="setting-modal-content"
className={style.wrapper}
ref={modalContentWrapperRef}
>
<div ref={modalContentRef} className={style.centerContainer}>
<div className={style.content}>
<Suspense fallback={<WorkspaceDetailSkeleton />}>
{activeTab.startsWith('workspace:') && workspaceMetadata ? (
<WorkspaceSetting
subTab={activeTab.split(':')[1] as WorkspaceSubTab}
key={workspaceMetadata.id}
workspaceMetadata={workspaceMetadata}
/>
) : null}
{isGeneralSetting(activeTab) ? (
<GeneralSetting generalKey={activeTab} />
) : null}
{activeTab === 'account' && loginStatus === 'authenticated' ? (
<AccountSetting />
) : null}
</Suspense>
</div>
<div className={style.footer}>
<ContactWithUsIcon fontSize={16} />
<Trans
i18nKey={'com.affine.settings.suggestion-2'}
components={{
1: (
<span
className={style.link}
onClick={handleOpenStarAFFiNEModal}
/>
),
2: (
<span
className={style.link}
onClick={handleOpenIssueFeedbackModal}
<Scrollable.Root>
<Scrollable.Viewport
data-testid="setting-modal-content"
className={style.wrapper}
ref={modalContentWrapperRef}
>
<div ref={modalContentRef} className={style.centerContainer}>
<div className={style.content}>
<Suspense fallback={<WorkspaceDetailSkeleton />}>
{activeTab.startsWith('workspace:') && workspaceMetadata ? (
<WorkspaceSetting
subTab={activeTab.split(':')[1] as WorkspaceSubTab}
key={workspaceMetadata.id}
workspaceMetadata={workspaceMetadata}
/>
),
}}
/>
) : null}
{isGeneralSetting(activeTab) ? (
<GeneralSetting generalKey={activeTab} />
) : null}
{activeTab === 'account' && loginStatus === 'authenticated' ? (
<AccountSetting />
) : null}
</Suspense>
</div>
<div className={style.footer}>
<ContactWithUsIcon fontSize={16} />
<Trans
i18nKey={'com.affine.settings.suggestion-2'}
components={{
1: (
<span
className={style.link}
onClick={handleOpenStarAFFiNEModal}
/>
),
2: (
<span
className={style.link}
onClick={handleOpenIssueFeedbackModal}
/>
),
}}
/>
</div>
</div>
</div>
</div>
<Scrollable.Scrollbar />
</Scrollable.Viewport>
</Scrollable.Root>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@ export const wrapper = style({
height: '100%',
// margin: '0 auto',
padding: '40px 15px 20px 15px',
overflowX: 'hidden',
overflowY: 'auto',
display: 'flex',
justifyContent: 'center',
'::-webkit-scrollbar': {
display: 'none',
},
});
export const centerContainer = style({
width: '100%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ const TIMEOUT = 50000;

const client = new CopilotClient();

async function calculateBlobHash(blob: Blob) {
const buffer = await blob.arrayBuffer();
const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);
const hashArray = Array.from(new Uint8Array(hashBuffer));
return hashArray
.map(byte => byte.toString(16).padStart(2, '0'))
.join('')
.slice(0, 32);
}

export type TextToTextOptions = {
docId: string;
workspaceId: string;
Expand Down Expand Up @@ -86,7 +76,7 @@ async function createSessionMessage({
if (blob instanceof File) {
return blob;
} else {
return new File([blob], await calculateBlobHash(blob), {
return new File([blob], sessionId, {
type: blob.type,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ export class TelemetryService extends Service {
}

onApplicationStart() {
if (process.env.MIXPANEL_TOKEN) {
mixpanel.init(process.env.MIXPANEL_TOKEN || '', {
track_pageview: true,
persistence: 'localStorage',
});
}
const account = this.auth.session.account$.value;
if (account) {
mixpanel.identify(account.id);
Expand Down
10 changes: 2 additions & 8 deletions packages/frontend/core/src/telemetry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@ import { useLayoutEffect } from 'react';
export function Telemetry() {
const settings = useAtomValue(appSettingAtom);
useLayoutEffect(() => {
if (process.env.MIXPANEL_TOKEN) {
mixpanel.init(process.env.MIXPANEL_TOKEN || '', {
track_pageview: true,
persistence: 'localStorage',
});
if (settings.enableTelemetry === false) {
mixpanel.opt_out_tracking();
}
if (settings.enableTelemetry === false) {
mixpanel.opt_out_tracking();
}
}, [settings.enableTelemetry]);
return null;
Expand Down
8 changes: 4 additions & 4 deletions packages/frontend/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
"@affine/env": "workspace:*",
"@affine/i18n": "workspace:*",
"@affine/native": "workspace:*",
"@blocksuite/block-std": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/blocks": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/presets": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/store": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/block-std": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/blocks": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/presets": "0.14.0-canary-202405070334-778ff10",
"@blocksuite/store": "0.14.0-canary-202405070334-778ff10",
"@electron-forge/cli": "^7.3.0",
"@electron-forge/core": "^7.3.0",
"@electron-forge/core-utils": "^7.3.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/electron/renderer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import '@affine/core/bootstrap/preload';
import { appConfigProxy } from '@affine/core/hooks/use-app-config-storage';
import { performanceLogger } from '@affine/core/shared';
import { apis, events } from '@affine/electron-api';
import { init, replayIntegration, setTags } from '@sentry/electron/renderer';
import { init, setTags } from '@sentry/electron/renderer';
import {
init as reactInit,
reactRouterV6BrowserTracingIntegration,
Expand Down Expand Up @@ -50,7 +50,6 @@ function main() {
createRoutesFromChildren,
matchRoutes,
}),
replayIntegration(),
],
},
reactInit
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@types/uuid": "^9.0.8",
"ava": "^6.1.2",
"cross-env": "^7.0.3",
"nx": "^18.2.4",
"nx": "^19.0.0",
"nx-cloud": "^18.0.0",
"rxjs": "^7.8.1",
"ts-node": "^10.9.2",
Expand Down
2 changes: 0 additions & 2 deletions packages/frontend/web/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { isDesktop } from '@affine/env/constant';
import {
init,
reactRouterV6BrowserTracingIntegration,
replayIntegration,
setTags,
} from '@sentry/react';
import { StrictMode, useEffect } from 'react';
Expand Down Expand Up @@ -44,7 +43,6 @@ function main() {
createRoutesFromChildren,
matchRoutes,
}),
replayIntegration(),
],
});
setTags({
Expand Down
2 changes: 1 addition & 1 deletion tools/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@affine/env": "workspace:*",
"@affine/templates": "workspace:*",
"@aws-sdk/client-s3": "3.537.0",
"@blocksuite/presets": "0.14.0-canary-202405070156-0d03364",
"@blocksuite/presets": "0.14.0-canary-202405070334-778ff10",
"@clack/core": "^0.3.4",
"@clack/prompts": "^0.7.0",
"@magic-works/i18n-codegen": "^0.5.0",
Expand Down
Loading

0 comments on commit cff3eb7

Please sign in to comment.