MCPcopy Create free account
hub / github.com/coder/mux / renderSection

Function renderSection

src/browser/components/ProjectSidebar/ProjectSidebar.tsx:2701–2799  ·  view source on GitHub ↗
(section: SectionConfig)

Source from the content-addressed store, hash-verified

2699
2700 // Render section with its workspaces
2701 const renderSection = (section: SectionConfig) => {
2702 const sectionWorkspaces = bySectionId.get(section.id) ?? [];
2703 const sectionAllWorkspaces =
2704 allBySectionIdForNormalRendering.get(section.id) ?? [];
2705 const sectionDrafts = draftsBySectionId.get(section.id) ?? [];
2706 const sectionHasPromotedAttention = sectionDrafts.some((draft) => {
2707 const promotedMetadata = activeDraftPromotions[draft.draftId];
2708 return promotedMetadata
2709 ? workspaceAttentionById.get(promotedMetadata.id) === true
2710 : false;
2711 });
2712 const sectionHasAttention =
2713 sectionAllWorkspaces.some(
2714 (workspace) => workspaceAttentionById.get(workspace.id) === true
2715 ) || sectionHasPromotedAttention;
2716
2717 const sectionExpandedKey = getSectionExpandedKey(
2718 projectPath,
2719 section.id
2720 );
2721 const isSectionExpanded =
2722 expandedSections[sectionExpandedKey] ?? true;
2723 const shouldAutoEditSection =
2724 autoEditingSection?.projectPath === projectPath &&
2725 autoEditingSection?.sectionId === section.id;
2726
2727 return (
2728 <WorkspaceSectionDropZone
2729 key={section.id}
2730 projectPath={projectPath}
2731 sectionId={section.id}
2732 onDrop={handleWorkspaceSectionDrop}
2733 >
2734 <SectionHeader
2735 section={section}
2736 isExpanded={isSectionExpanded}
2737 workspaceCount={
2738 sectionWorkspaces.length + sectionDrafts.length
2739 }
2740 hasAttention={sectionHasAttention}
2741 onToggleExpand={() => toggleSection(projectPath, section.id)}
2742 onAddWorkspace={() => {
2743 // Create workspace in this section
2744 handleAddWorkspace(projectPath, section.id);
2745 }}
2746 onRename={(name) => {
2747 if (shouldAutoEditSection) {
2748 setAutoEditingSection(null);
2749 }
2750 void updateDisplayName(section.id, name);
2751 }}
2752 onChangeColor={(color) => {
2753 void updateProjectColor(section.id, color);
2754 }}
2755 autoStartEditing={shouldAutoEditSection}
2756 onAutoCreateAbandon={
2757 shouldAutoEditSection
2758 ? () => {

Callers

nothing calls this directly

Calls 7

getSectionExpandedKeyFunction · 0.90
getSectionTierKeyFunction · 0.90
toggleSectionFunction · 0.85
handleRemoveSectionFunction · 0.85
renderDraftFunction · 0.85
renderAgeTiersFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected