How to use the @codesandbox/common/lib/utils/get-sandbox-name.getSandboxName function in @codesandbox/common

To help you get started, we’ve selected a few @codesandbox/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codesandbox / codesandbox-client / packages / app / src / app / components / SandboxList / SandboxList.tsx View on Github external
{sandboxes.map((s, i) => {
        // TODO: investigate type mismatch between SmallSandbox and getIcon
        // @ts-ignore
        const Icon = getIcon(s.template);

        return (
          
            
              {/* We should probably use the Sandbox interface instead
                 * of SmallSandbox
                // @ts-ignore */}
              {getSandboxName(s)}
              
            
            {format(new Date(s.insertedAt), 'MMM dd, yyyy')}
            {format(new Date(s.updatedAt), 'MMM dd, yyyy')}
            
              
            
            {s.likeCount}
            {s.viewCount}
            {s.forkCount}
            {isCurrentUser && onDelete ? (
              
                
              
            ) : null}
github codesandbox / codesandbox-client / packages / app / src / app / pages / Dashboard / Content / SandboxGrid / index.tsx View on Github external
const dir =
        basename(item.collection.path) ||
        (item.collection.teamId ? 'Team Sandboxes' : 'My Sandboxes');

      if (dir) {
        editedSince += ` in ${dir}`;
      }
    }

    const itemInSelection = this.selectedSandboxesObject[item.id];

    return (
github codesandbox / codesandbox-client / packages / app / src / embed / components / legacy / Header / index.js View on Github external
function Header({
  sandbox,
  showEditor,
  showPreview,
  setEditorView,
  setPreviewView,
  setMixedView,
  toggleSidebar,
  toggleLike,
  liked,
}: Props) {
  const sandboxTitle = getSandboxName(sandbox);

  return (
    
      
        
        <title title="{sandboxTitle}">{sandboxTitle}</title>
github codesandbox / codesandbox-client / packages / app / src / app / pages / Sandbox / Editor / Workspace / items / NotOwnedSandboxInfo / SandboxInfo.tsx View on Github external
{(sandbox.forkedFromSandbox || sandbox.forkedTemplateSandbox) &amp;&amp; (
          
            
              {sandbox.forkedTemplateSandbox ? 'Based On' : 'Forked From'}
            
            
              
                {getSandboxName(
                  sandbox.forkedFromSandbox || sandbox.forkedTemplateSandbox
                )}
              
            
          
        )}
      
    
  );
};
github codesandbox / codesandbox-client / packages / app / src / app / pages / Search / Results / index.js View on Github external
hitComponent={({ hit }) =&gt; (
           selectSandbox(hit)}
            noHeight
            sandbox={{
              ...hit,
              title: getSandboxName({
                id: hit.objectID,
                alias: hit.alias,
                git: hit.git,
                title: hit.title,
              }),
              id: hit.objectID,
            }}
          /&gt;
        )}
      /&gt;
github codesandbox / codesandbox-client / packages / app / src / app / pages / Sandbox / Editor / Workspace / Project / index.js View on Github external
onKeyUp={event =&gt; {
                  if (event.keyCode === 13) {
                    this.updateSandboxInfo();
                  }
                }}
                ref={el =&gt; {
                  if (el) {
                    el.focus();
                  }
                }}
                placeholder="Title"
              /&gt;
            
          ) : (
            <title>
              {workspace.project.title || getSandboxName(sandbox)}
              {editable &amp;&amp; &lt;EditPen onClick={this.setTitleEditing} /&gt;}
            </title>
          )}
          {this.state.editingDescription ? (
            
              <textarea value="{workspace.project.description}"> {
                  signals.workspace.valueChanged({
                    field: 'description',
                    value: event.target.value,
                  });
                }}
                type="text"
                onBlur={this.updateSandboxInfo}
                onKeyDown={event =&gt; {</textarea>
github codesandbox / codesandbox-client / packages / app / src / app / pages / Dashboard / Content / routes / Templates / BookmarkedTemplates / index.tsx View on Github external
const orderedTemplates = sortBy(sortedTemplates, template =>
    getSandboxName(template.sandbox).toLowerCase()
  );
github codesandbox / codesandbox-client / packages / app / src / app / pages / Sandbox / Editor / Workspace / items / NotOwnedSandboxInfo / SandboxInfo.tsx View on Github external
export const SandboxInfo = ({ sandbox }: ISandboxInfoProps) =&gt; {
  const environment = getTemplateDefinition(sandbox.template);
  const customTemplate = sandbox.customTemplate;

  return (
    
      
        {customTemplate &amp;&amp; (
          
        )}
        <div>
          <title>
            {getSandboxName(sandbox)}{' '}
            &lt;PrivacyStatus
              style={{ marginLeft: '0.25rem' }}
              asIcon
              privacy={sandbox.privacy}
            /&gt;
          </title>
          
                The environment determines how a sandbox is executed, you can
                find more info{' '}
                <a href="/docs/environment">
                  here
                </a></div>