MCPcopy Index your code
hub / github.com/coder/coder / WorkspaceResultsRow

Function WorkspaceResultsRow

site/src/pages/WorkspacesPage/WorkspacesButton.tsx:118–166  ·  view source on GitHub ↗
({ template })

Source from the content-addressed store, hash-verified

116}
117
118const WorkspaceResultsRow: FC<WorkspaceResultsRowProps> = ({ template }) => {
119 const getLink = useLinks();
120 const templateLink = getLink(
121 linkToTemplate(template.organization_name, template.name),
122 );
123
124 return (
125 <PopoverLink
126 to={`${templateLink}/workspace`}
127 className="flex gap-3 items-center"
128 >
129 <Avatar
130 variant="icon"
131 src={template.icon}
132 fallback={template.display_name || template.name}
133 />
134
135 <div
136 css={(theme) => ({
137 color: theme.palette.text.primary,
138 display: "flex",
139 flexDirection: "column",
140 lineHeight: "140%",
141 fontSize: 14,
142 overflow: "hidden",
143 })}
144 >
145 <span className="whitespace-nowrap text-ellipsis">
146 {template.display_name || template.name || "[Unnamed]"}
147 </span>
148 <span
149 css={(theme) => ({
150 fontSize: 13,
151 color: theme.palette.text.secondary,
152 })}
153 >
154 {/*
155 * There are some templates that have -1 as their user count –
156 * basically functioning like a null value in JS. Can safely just
157 * treat them as if they were 0.
158 */}
159 {template.active_user_count <= 0 ? "No" : template.active_user_count}{" "}
160 developer
161 {template.active_user_count === 1 ? "" : "s"}
162 </span>
163 </div>
164 </PopoverLink>
165 );
166};
167
168const PopoverLink: FC<RouterLinkProps> = ({ children, ...linkProps }) => {
169 return (

Callers

nothing calls this directly

Calls 2

useLinksFunction · 0.90
linkToTemplateFunction · 0.90

Tested by

no test coverage detected