Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/input UI schema #499

Merged
merged 3 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bug fixes

- [#499](https://github.com/alleslabs/celatone-frontend/pull/499) Fix sometimes select widget input not full, manual schema upload max lines, and expand/collapse all chevron
- [#497](https://github.com/alleslabs/celatone-frontend/pull/497) Fix stored codes route and navbar behavior from dev to normal mode
- [#470](https://github.com/alleslabs/celatone-frontend/pull/470) Fix json schema array field default behavior
- [#476](https://github.com/alleslabs/celatone-frontend/pull/476) Fix terra rpc
Expand Down
3 changes: 1 addition & 2 deletions src/lib/components/json-schema/JsonSchemaDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export const JsonSchemaDrawer = ({
>
<Text variant="body2" color="text.dark">
Please note that the JSON schema you upload on our website will only
be stored locally on your device. For public projects with verified
JSON schemas, they will be visible and accessible to others.
be stored locally on your device.
</Text>
</Box>
<UploadTemplate
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/json-schema/UploadTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ const MethodRender = ({
})
}
validateFn={validateSchema}
maxLines={25}
/>
</>
);
Expand Down
14 changes: 8 additions & 6 deletions src/lib/components/json-schema/section/SchemaInputSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ export const SchemaInputSection = observer(
</Flex>
</Flex>
{/* TODO: revisit type assertion later */}
<JsonSchemaForm
schema={jsonSchema[type] as RJSFSchema}
formId={type}
initialFormData={initialFormData}
onChange={(data) => setSchemaInput(JSON.stringify(data))}
/>
<div style={{ width: "100%" }}>
<JsonSchemaForm
schema={jsonSchema[type] as RJSFSchema}
formId={type}
initialFormData={initialFormData}
onChange={(data) => setSchemaInput(JSON.stringify(data))}
/>
</div>
</>
) : (
<>
Expand Down
6 changes: 4 additions & 2 deletions src/lib/components/json/JsonInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface JsonInputProps {
topic?: string;
text?: string;
minLines?: number;
maxLines?: number;
setText: (value: string) => void;
validateFn?: (value: string) => string | null;
}
Expand Down Expand Up @@ -74,6 +75,7 @@ const JsonInput = ({
topic,
text = "",
minLines = 16,
maxLines = 100,
setText,
validateFn = jsonValidate,
}: JsonInputProps) => {
Expand Down Expand Up @@ -103,8 +105,8 @@ const JsonInput = ({
const lines = jsonLineCount(text);

// Limit the number of lines from minLines (default is 16) to 100
return Math.min(Math.max(lines, minLines), 100);
}, [text, minLines]);
return Math.min(Math.max(lines, minLines), maxLines);
}, [text, minLines, maxLines]);

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ export const CodeSchemaSection = ({
border="1px solid var(--chakra-colors-gray-700)"
borderRadius="8px"
>
Uploaded JSON schemas are stored locally on your device. Public projects
with verified JSON schemas are visible and accessible to others.
Uploaded JSON schemas are stored locally on your device.
</Text>
<Tabs variant="unstyled" orientation="vertical" mt={6}>
<TabList>
Expand Down
7 changes: 6 additions & 1 deletion src/lib/pages/execute/components/schema-execute/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ export const SchemaExecute = ({
/>
<Button
variant="outline-gray"
rightIcon={<CustomIcon name="chevron-down" boxSize={3} />}
rightIcon={
<CustomIcon
name={expandedIndexes.length ? "chevron-up" : "chevron-down"}
boxSize={3}
/>
}
minH="40px"
onClick={() => {
AmpTrackExpandAll(expandedIndexes.length ? "collapse" : "expand");
Expand Down
9 changes: 7 additions & 2 deletions src/lib/pages/pools/components/unsupportedSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,16 @@ export const UnsupportedSection = ({
<Flex gap={2} alignItems="center">
<Button
variant="outline-gray"
w="94px"
size="sm"
rightIcon={
<CustomIcon
name={expandedIndexes.length ? "chevron-up" : "chevron-down"}
boxSize={3}
/>
}
onClick={() => {
AmpTrackExpandAll(
!expandedIndexes.length ? "expand" : "collapse"
expandedIndexes.length ? "collapse" : "expand"
);
setExpandedIndexes((prev) =>
!prev.length ? Array.from(Array(pageSize).keys()) : []
Expand Down
8 changes: 7 additions & 1 deletion src/lib/pages/query/components/SchemaQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,13 @@ export const SchemaQuery = ({
/>
<Button
variant="outline-gray"
rightIcon={<CustomIcon name="chevron-down" boxSize={3} />}
rightIcon={
<CustomIcon
name={expandedIndexes.length ? "chevron-up" : "chevron-down"}
boxSize={3}
right={0}
/>
}
minH="40px"
onClick={() => {
AmpTrackExpandAll(expandedIndexes.length ? "collapse" : "expand");
Expand Down