Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(electron): multi tabs support #7440

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

pengx17
Copy link
Collaborator

@pengx17 pengx17 commented Jul 7, 2024

use https://www.electronjs.org/docs/latest/api/web-contents-view to serve different tab views
added tabs view manager in electron to handle multi-view actions and events.

Copy link

graphite-app bot commented Jul 7, 2024

Your org has enabled the Graphite merge queue for merging into canary

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link
Collaborator Author

pengx17 commented Jul 7, 2024

@github-actions github-actions bot added mod:infra Environment related issues and discussions app:electron Related to electron app app:core labels Jul 7, 2024
Copy link

nx-cloud bot commented Jul 7, 2024

Copy link

codecov bot commented Jul 7, 2024

Codecov Report

Attention: Patch coverage is 8.87372% with 267 lines in your changes missing coverage. Please review.

Project coverage is 56.45%. Comparing base (6bc5337) to head (1eb7408).
Report is 1 commits behind head on canary.

Files Patch % Lines
...tabs-header/services/desktop-state-synchronizer.ts 1.31% 75 Missing ⚠️
...s/workbench/services/desktop-state-synchronizer.ts 1.36% 72 Missing ⚠️
.../modules/app-tabs-header/views/app-tabs-header.tsx 6.25% 45 Missing ⚠️
...pp-tabs-header/services/app-tabs-header-service.ts 0.00% 18 Missing ⚠️
...d/core/src/modules/workbench/entities/workbench.ts 0.00% 8 Missing ⚠️
...modules/workbench/services/workbench-view-state.ts 20.00% 8 Missing ⚠️
...core/src/modules/workbench/view/workbench-link.tsx 0.00% 6 Missing ⚠️
...frontend/core/src/components/app-sidebar/index.tsx 0.00% 4 Missing ⚠️
...kages/frontend/core/src/modules/workbench/index.ts 0.00% 4 Missing ⚠️
...es/frontend/core/src/components/page-list/list.tsx 0.00% 3 Missing ⚠️
... and 16 more
Additional details and impacted files
@@            Coverage Diff             @@
##           canary    #7440      +/-   ##
==========================================
- Coverage   57.19%   56.45%   -0.74%     
==========================================
  Files         937      949      +12     
  Lines       41612    42264     +652     
  Branches     4781     4930     +149     
==========================================
+ Hits        23799    23860      +61     
- Misses      17456    18047     +591     
  Partials      357      357              
Flag Coverage Δ
server-test 78.82% <ø> (+0.07%) ⬆️
unittest 27.49% <8.87%> (-0.77%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pengx17 pengx17 force-pushed the 07-08-feat_electron_multi_tabs_support branch 4 times, most recently from 804b9cb to c5548bd Compare July 10, 2024 09:10
@pengx17 pengx17 force-pushed the 07-08-feat_electron_multi_tabs_support branch 14 times, most recently from 8ad9cfa to 1b5027c Compare July 14, 2024 07:51
@pengx17 pengx17 changed the base branch from canary to eyhn/feat/electron-shared-storage July 14, 2024 07:52
@EYHN EYHN force-pushed the eyhn/feat/electron-shared-storage branch from 1a8ee68 to 4b622ef Compare July 15, 2024 02:31
@pengx17 pengx17 force-pushed the 07-08-feat_electron_multi_tabs_support branch 6 times, most recently from a91ca88 to 5f97f19 Compare July 26, 2024 07:54
@pengx17 pengx17 force-pushed the 07-08-feat_electron_multi_tabs_support branch 3 times, most recently from 014a765 to 010ad31 Compare July 26, 2024 09:11
@pengx17 pengx17 force-pushed the 07-08-feat_electron_multi_tabs_support branch from 010ad31 to 0fd21d5 Compare July 26, 2024 10:07
@pengx17 pengx17 force-pushed the 07-08-feat_electron_multi_tabs_support branch from 0fd21d5 to 1eb7408 Compare July 26, 2024 10:10
</button>

{viewIdx !== workbench.views.length - 1 ? (
<div className={styles.splitViewSeparator} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not border

activeView$ = LiveData.computed(get => {
const activeIndex = get(this.activeViewIndex$);
const views = get(this.views$);
return views[activeIndex];
return views[activeIndex]; // todo: this could be null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's hard to fix default active view index to 0, I perfer not persisting it, we can still get all tabs back though

@@ -206,18 +206,27 @@ const DetailPageImpl = memo(function DetailPageImpl() {
[jumpToPageBlock, docCollection.id, openPage, jumpToTag, workspace.id]
);

const [container, setContainer] = useState<HTMLElement | null>(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not useRef

@@ -20,12 +13,12 @@ export function useHasScrollTop(ref: RefObject<HTMLElement> | null) {
}
}

container.addEventListener('scroll', updateScrollTop);
container?.addEventListener('scroll', updateScrollTop);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debounce

subscription();
// subscription on quit sometimes crashes the app
try {
subscription();
Copy link
Member

@forehalo forehalo Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsubscribe

?.split('=')[1],
windowName:
process.argv.find(arg => arg.startsWith('--window-name='))?.split('=')[1] ??
'unknown',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe ${schema}?

Copy link
Member

@forehalo forehalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:core app:electron Related to electron app mod:component mod:dev mod:infra Environment related issues and discussions test Related to test cases
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

3 participants