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

Export data view #3056

Merged
merged 17 commits into from
Feb 10, 2024
Merged

Export data view #3056

merged 17 commits into from
Feb 10, 2024

Conversation

OAGr
Copy link
Contributor

@OAGr OAGr commented Feb 7, 2024

image image

Copy link

changeset-bot bot commented Feb 7, 2024

🦋 Changeset detected

Latest commit: c2fd7f5

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

This PR includes changesets to release 7 packages
Name Type
@quri/squiggle-lang Patch
@quri/squiggle-components Patch
vscode-squiggle Patch
@quri/ui Patch
@quri/prettier-plugin-squiggle Patch
@quri/versioned-squiggle-components Patch
@quri/squiggle-textmate-grammar Patch

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

Copy link

vercel bot commented Feb 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quri-hub ✅ Ready (Inspect) Visit Preview Feb 10, 2024 0:18am
squiggle-components ✅ Ready (Inspect) Visit Preview Feb 10, 2024 0:18am
squiggle-website ✅ Ready (Inspect) Visit Preview Feb 10, 2024 0:18am
1 Ignored Deployment
Name Status Preview Updated (UTC)
quri-ui ⬜️ Ignored (Inspect) Visit Preview Feb 10, 2024 0:18am

Copy link
Collaborator

@berekuk berekuk left a comment

Choose a reason for hiding this comment

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

Overall, this looks solid.

One more minor thing: this doesn't work for SquiggleEditor, and eventually we'll want feature parity there (e.g. when we start using imports in doc examples).

packages/components/src/lib/hooks/useSimulatorManager.ts Outdated Show resolved Hide resolved
onOpenExport(
exportData.sourceId,
exportData.path[0] || undefined
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd like to cmd+click to open these in new tabs, but I can't.

This doesn't seem easily fixable with a single onOpenExport; simulating the precise behavior of native links is hard (also, links won't work properly before the hydration).

How about this?

  • pass linkComponent through props and context (the appropriate type for it is FC<PropsWithChildren<{ href: string }> | "a", defaulting to "a")
  • wrap <LinkIcon> with it (rename to capitalized version to use it in JSX)
  • change onOpenExport to getExportLink or something

linkComponent could be in Playground props. Or, even better, we could have a single global provider for it in @quri/ui, because I suspect it'll be useful in a few other places too. (One example: DropdownMenuLinkItem vs DropdownMenuNextLinkItem).

It's not a problem if we improve this after this PR is merged, but I'd like to do it before the next release, to avoid versioned-components complications.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems good to figure out in a different PR!

{taggedName || name}
</span>
{showColon && <span className="text-gray-400 font-mono">:</span>}
{(isRootImport && exportData?.sourceId) || taggedName || name}
Copy link
Collaborator

Choose a reason for hiding this comment

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

When something is imported and then copied to a local var (not sure why someone would do that, but...), it's displayed as its source id:
Screenshot 2024-02-09 at 16 40 04

I can also imagine that seeing "as" name in "Imports" tab can be useful in other cases (e.g. I'm reading the code and want to refer to things that are available).

Maybe we could show both here, "foo from hub:source1"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should figure out some better solution here, likely a bit later on.

…gle into export-data

* 'export-data' of github.com:quantified-uncertainty/squiggle:
  fix route and router import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants