Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/components/ModelCatalog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,15 @@ const ModelCatalog = ({ models }) => {
</div>
</div>
<div className="flex md:w-3/4 w-full gap-[1%] items-stretch self-start flex-wrap !mt-0">
{modelList.length === 0 && (
<div className="border bg-gray-50 rounded-md w-full flex-col flex align-middle justify-center text-center py-6">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we're missing dark mode styling for this, but otherwise looks good!

image

<span className="text-lg !font-bold">No models found</span>
<p>
Try a different search term, or broaden your search by removing
filters.
</p>
</div>
)}
{modelList.map((model) => {
const isBeta = model.model.properties.find(
({ property_id, value }) =>
Expand Down
38 changes: 24 additions & 14 deletions src/components/models/SchemaRow.astro
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
---
import { Type } from "~/components";
import { Type, MetaInfo } from "~/components";
import { type SchemaNode } from "@stoplight/json-schema-tree";
const { node } = Astro.props;
const { node, root } = Astro.props;
---

<li class="my-2 !list-none">
<code class="mr-2 font-mono rounded-md bg-gray-100">
{node.subpath[node.subpath.length - 1]}
</code>
<li
class={`py-2 !my-0 !list-none ${root ? "" : "border-l border-l-gray-200 pl-4"}`}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The colour feels like it might be too light on dark mode, but that's just a nit so happy to leave it as-is.

image

>
{
node.title ? (
<span class="mr-2 font-bold">{node.title}</span>
) : (
<code class="mr-2 !pr-0 font-mono rounded-md bg-gray-100">
{node.subpath[node.subpath.length - 1]}
</code>
)
}

{node.primaryType && <Type text={node.primaryType} />}
{node.combiners && node.combiners.includes("oneOf") && <Type text="one of" />}

{
node.annotations.default && (
<span class="text-xs mr-2">default {node.annotations.default}</span>
<MetaInfo text={`default ${node.annotations.default}`} />
)
}
{
(node.validations.minLength !== undefined ||
node.validations.minimum !== undefined) && (
<span class="text-xs mr-2">
min {node.validations.minLength || node.validations.minimum}
</span>
<MetaInfo
text={`min ${node.validations.minLength || node.validations.minimum}`}
/>
)
}
{
(node.validations.maxLength !== undefined ||
node.validations.maximum !== undefined) && (
<span class="text-xs">
max {node.validations.maxLength || node.validations.maximum}
</span>
<MetaInfo
text={`max ${node.validations.maxLength || node.validations.maximum}`}
/>
)
}
<p>{node.annotations.description}</p>
<p class="!mb-0">{node.annotations.description}</p>

{
node.children && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/models/SchemaViewer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jsonSchemaTree.populate();
<ul class="list-none m-0 p-0">
{
(jsonSchemaTree.root.children[0] as RegularNode).children?.map(
(node: SchemaNode) => <SchemaRow node={node} />,
(node: SchemaNode) => <SchemaRow node={node} root />,
)
}
</ul>
Loading