Skip to content

Add preview for org / project name for DSN #13015

@philprime

Description

@philprime

Problem Statement

During an "audit"/testing of the Cocoa SDK onboarding flow I got redirected from the sentry-wizard to the configuration documentation and I copied the configuration snippet by clicking the copy button in the top right corner.

Image

I did not click on the DSN, therefore it did see which org/project I chose and when I started sending events via the Cocoa SDK the events did not show up, because they DSN was for another project. If it somehow displayed the org/project I might have noticed earlier that the DSN was for the wrong one.

Solution Brainstorm

One idea would be displaying the selected org / project with the DSN.

I drafted a simple visual example by editing the keywordSelector.tsx, replacing the span with this code snippet:

        <span
          style={{
            // We set inline-grid only when animating the keyword so they
            // correctly overlap during animations, but this must be removed
            // after so copy-paste correctly works.
            display: isAnimating ? 'inline-grid' : undefined,
            position: 'relative',
          }}
        >
          <AnimatePresence initial={false}>
            <Keyword
              onAnimationStart={() => setIsAnimating(true)}
              onAnimationComplete={() => setIsAnimating(false)}
              key={currentSelectionIdx}
            >
              {currentSelection[keyword]}
            </Keyword>
          </AnimatePresence>
          {currentSelection?.title && (
            <div
              style={{
                position: 'absolute',
                top: '-20px',
                left: '50%',
                transform: 'translateX(-50%)',
                fontSize: '12px',
                backgroundColor: isDarkMode ? '#333' : '#f5f5f5',
                color: isDarkMode ? '#fff' : '#333',
                padding: '2px 6px',
                borderRadius: '3px',
                pointerEvents: 'none',
                whiteSpace: 'nowrap',
                opacity: 0.9,
                userSelect: 'none',
              }}
            >
              {currentSelection.title}
            </div>
          )}
        </span>

This looked something like this:

Image

Another idea would be changing the tooltip/alert/message/toast of the copy button to display what exactly has been copied:

Image

This might no help if a user selects the code by cursor and copies it as text.

cc @jas-kas @kahest

Metadata

Metadata

Assignees

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions