MCPcopy Create free account
hub / github.com/TanStack/devtools / renderDeps

Function renderDeps

examples/preact/basic/src/package-json-panel.tsx:226–284  ·  view source on GitHub ↗
(title: string, deps?: Record<string, string>)

Source from the content-addressed store, hash-verified

224 }
225
226 const renderDeps = (title: string, deps?: Record<string, string>) => {
227 const names = Object.keys(deps || {})
228 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
229 const someOutdatedInSection = names.some((n) => !!outdatedDeps[n])
230 return (
231 <div style={sectionStyle}>
232 <div
233 style={{
234 display: 'flex',
235 alignItems: 'center',
236 justifyContent: 'space-between',
237 gap: 6,
238 }}
239 >
240 <h3 style={{ margin: 0, fontSize: 14 }}>{title}</h3>
241 {someOutdatedInSection ? <BulkActions names={names} /> : null}
242 </div>
243 <table style={tableStyle}>
244 <thead>
245 <tr>
246 <th style={thtd}>Package</th>
247 <th style={thtd}>Version</th>
248 <th style={thtd}>Status</th>
249 <th style={thtd}>Actions</th>
250 </tr>
251 </thead>
252 <tbody>
253 {Object.entries(deps || {}).map(([dep, version]) => {
254 const info = outdatedDeps[dep] as
255 | {
256 current: string
257 wanted: string
258 latest: string
259 type?: 'dependencies' | 'devDependencies'
260 }
261 | undefined
262 const isOutdated = !!info && info.current !== info.latest
263 return (
264 <tr key={dep}>
265 <td style={thtd}>{dep}</td>
266 <td style={thtd}>
267 <VersionCell dep={dep} specified={version} />
268 </td>
269 <td style={thtd}>
270 {isOutdated
271 ? badge('Outdated', '#e11d48')
272 : badge('OK', '#10b981')}
273 </td>
274 <td style={thtd}>
275 {isOutdated ? <UpgradeRowActions name={dep} /> : null}
276 </td>
277 </tr>
278 )
279 })}
280 </tbody>
281 </table>
282 </div>
283 )

Callers 1

PackageJsonPanelFunction · 0.70

Calls 1

badgeFunction · 0.70

Tested by

no test coverage detected