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: tabs #2197

Merged
merged 17 commits into from
Mar 27, 2022
Merged

feat: tabs #2197

merged 17 commits into from
Mar 27, 2022

Conversation

n1ru4l
Copy link
Collaborator

@n1ru4l n1ru4l commented Feb 22, 2022

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Feb 22, 2022

🦋 Changeset detected

Latest commit: 68a9382

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
graphiql Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Feb 22, 2022

Codecov Report

Merging #2197 (68a9382) into main (2d91916) will decrease coverage by 0.77%.
The diff coverage is 75.28%.

@@            Coverage Diff             @@
##             main    #2197      +/-   ##
==========================================
- Coverage   65.70%   64.93%   -0.78%     
==========================================
  Files          85       80       -5     
  Lines        5106     5338     +232     
  Branches     1631     1695      +64     
==========================================
+ Hits         3355     3466     +111     
- Misses       1747     1868     +121     
  Partials        4        4              
Impacted Files Coverage Δ
packages/codemirror-graphql/src/hint.ts 94.73% <ø> (ø)
packages/codemirror-graphql/src/lint.ts 100.00% <ø> (ø)
packages/codemirror-graphql/src/results/mode.ts 47.05% <ø> (ø)
...kages/codemirror-graphql/src/utils/forEachState.ts 100.00% <ø> (ø)
...ckages/codemirror-graphql/src/utils/mode-indent.ts 0.00% <0.00%> (ø)
packages/codemirror-graphql/src/variables/hint.ts 89.70% <ø> (ø)
packages/codemirror-graphql/src/variables/mode.ts 79.48% <ø> (ø)
packages/graphiql/src/utility/fillLeafs.ts 5.33% <ø> (ø)
...kages/graphiql/src/utility/introspectionQueries.ts 100.00% <ø> (ø)
packages/graphiql/src/utility/onHasCompletion.ts 2.17% <0.00%> (ø)
... and 68 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4686971...68a9382. Read the comment docs.

@acao
Copy link
Member

acao commented Feb 22, 2022

@n1ru4l IIII seee what you're doing now... and it's freakin' fabulous :) 💯

@acao
Copy link
Member

acao commented Feb 23, 2022

this is looking awesome! i appreciate this immensely

part of the reason we wanted to rewrite the react componetry for this effort is GraphiQL.tsx itself

as this PR progresses, let's try to pull as much out of this monolith component, and into context providers & consumers as possible. otherwise, it will be very hard to expose useful APIs for user-defined components

@acao
Copy link
Member

acao commented Feb 26, 2022

@n1ru4l today I will try to restore deploy previews so that the community can easily see your work and give feedback. thanks for this!

@n1ru4l n1ru4l marked this pull request as ready for review March 4, 2022 08:29
Copy link
Member

@acao acao left a comment

Choose a reason for hiding this comment

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

Let's see if we can architect this in a way that doesn't increase the complexity of the GraphiQL.tsx component as much

packages/graphiql/src/components/GraphiQL.tsx Outdated Show resolved Hide resolved
@acao
Copy link
Member

acao commented Mar 4, 2022

@n1ru4l are you up for a discord discussion perhaps? or we could even record a pairing session?

@acao
Copy link
Member

acao commented Mar 4, 2022

awesome! maybe they can live in a seperate file? would these be useful to people building other IDEs, and thus maybe live in a state management abstraction such as @graphiql/toolkit? if folks are using immer or similar it might not, but for many this could be quite useful, whether using vuex, redux, zustand, etc. if this level of abstraction feels like over doing it, then no bother, but the more we can reduce complexity in this file and move to seperate files or even if it makes sense packages, the better. also recall we have a plan for moving react-specific components to @graphiql/react to be consumed by graphiql pkg, but we don't have to worry about that now either, just giving a near-term view of the refactoring plans.

@acao acao self-requested a review March 4, 2022 09:55
@acao
Copy link
Member

acao commented Mar 4, 2022

I still want to wait until deploy previews are working again so users can review changes like this. I have the day off because of my injury but I can wrap up that and a few other efforts hopefully

@acao
Copy link
Member

acao commented Mar 8, 2022

@n1ru4l if you're able to make another commit, it should trigger a deploy preview now!

I will go through and update readme links later for the changed URLs, but this should work for now I think?

It disables some of the other deploy previews, and will be slow, but it at least gets us deploy previews for forked branches again

Copy link
Member

@acao acao left a comment

Choose a reason for hiding this comment

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

This is ready to merge in my opinion. But I'd like it if someone else was able to review it!

parameters.operationName = activeTab.operationName;
updateURL();
}

Copy link
Member

@acao acao Mar 10, 2022

Choose a reason for hiding this comment

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

Thanks for catching this detail! @harshithpabbati had a PR to add query parameter handling to the toolkit, which will make for a nice follow up. There is also the possibility of making it an internal detail in 2.0.0 if we are careful

packages/graphiql/src/components/GraphiQL.tsx Show resolved Hide resolved
@timsuchanek timsuchanek self-requested a review March 11, 2022 13:55
@timsuchanek
Copy link
Member

This is ready to merge in my opinion. But I'd like it if someone else was able to review it!

I'll review this over the weekend!

@timsuchanek
Copy link
Member

Quick update: I'm checking out the PR now, working on a few styling adjustments that I'll propose shortly.
One question for @n1ru4l: Did you try out, if subscriptions are correctly working when switching back and forth between tabs with running subscriptions?

@acao
Copy link
Member

acao commented Mar 12, 2022

Though this doesn’t matter now with codemirror-graphql, a note for 2.0.0: with monaco-editor we will need to be sure to not destroy the editor instance when changing tabs and instead to editor.setModel() and change settings dynamically. This was a suggestion from the vscode team!

the model history is preserved in memory, so when you toggle back to a tab where you using before, the model undo/redo stack for that tab will still be available

@timsuchanek
Copy link
Member

timsuchanek commented Mar 13, 2022

This is a great start, awesome! I just worked on some styling adjustments, here the before and after:

Before

before.mp4

After

after.mp4

Changes

  • If the tab title goes further than 100px, the tabs don't scale. In the playground, we just let the tabs grow with the title, that worked well so far, so that's also what I'm suggesting here
  • The "X" (close button) is now using the same "X" unicode as the docs explorer and the styling is strongly inspired by how VSCode shows the tabs
  • Instead of going for bold activated tabs, I suggest to just change the color for now, as the bold (especially for longer texts) makes the tabs jump around a littlebit
  • Taking the style of the toolbar buttons for the "+" was a good idea, however in the row of tabs it feels a bit out of place. I turned that into a more minimal design that should fit better into the tabs.
  • I adjusted the .active, :active and :hover background colors a bit - they seemed quite strong and I think the goal of showing which tab is active can be achieved with more smooth contrast

Let me know if you object any of the changes, happy to discuss them. For simplicity, I just went ahead and committed them already to this PR.
One thing I noticed, is that there's quite some delay between typing and the tab name updating. Not a big problem, just noticed that.
So once the subscriptions are tested and cleared, this can be merged from my side!

@acao
Copy link
Member

acao commented Mar 14, 2022

@timsuchanek looks like you need to fix a few of the unit tests

@timsuchanek
Copy link
Member

Thanks @acao, will do so in a bit!

Copy link
Member

@acao acao left a comment

Choose a reason for hiding this comment

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

We just need to use tab, tablist and tabpanel roles and other related aria attributes, for proper tab navigation

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/tablist_role

this aria spec for tabs also determines which keyboard shortcuts we should use

update: switched to an approving review for now so as not to block, but with just a few attributes on a few components this could be made screen reader accessible

@acao
Copy link
Member

acao commented Mar 22, 2022

@timsuchanek I think this last commit should fix the tests 🥳

@timsuchanek
Copy link
Member

That's awesome! How do you want to go about the release? I'm happy to give it a try to learn the changeset workflow

@acao
Copy link
Member

acao commented Mar 23, 2022

@timsuchanek would love for you to do the honors!

here are the steps I would follow:

  1. verify the changeset we added here has everything we want to have in it - for the changelog, it will append to this file 'thanks @timsuchanek!' with a markdown link to your profile, to the commit and the PR
  2. once you merge this PR, the Version Packages PR will be updated, and you can see the new changelog diff there
  3. then, you can merge the Version Packages PR (see the note about CLA, it's fine despite the Linux CLA bot not liking the changeset bot)
  4. then we should probably promote the new release on discord & twitter - would be great to automate this part eventually, but there is some nuance, since it's easy for us to fire off ~3-7 releases at once.

@acao
Copy link
Member

acao commented Mar 23, 2022

@timsuchanek just rebased, good to go!

@acao
Copy link
Member

acao commented Mar 23, 2022

@timsuchanek found another bug i introduced - tab add button is now a child of a button ! oops. chrome doesn't like this and throws a runtime console error

@acao
Copy link
Member

acao commented Mar 26, 2022

@timsuchanek everything is looking good here! fixed that bug, found another regex issue with comments

@timsuchanek
Copy link
Member

Awesome! Thanks for looking into it @acao! I'll look into it tomorrow ✌️

@timsuchanek
Copy link
Member

This looks good, so I'm merging this now!

@timsuchanek timsuchanek merged commit 3137a6c into graphql:main Mar 27, 2022
@github-actions github-actions bot mentioned this pull request Mar 27, 2022
@n1ru4l n1ru4l deleted the feat-tabs branch July 5, 2022 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants