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

style: change antd theme config #66

Merged
merged 6 commits into from
Jul 22, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const DetailsSubInfo = ({
<>
&nbsp;•&nbsp;
{handleHashUpdate && (
<Button type="primary" ghost onClick={openUpdateHashModal}>
<Button size="large" type="primary" ghost onClick={openUpdateHashModal}>
Update Hash
</Button>
)}
Expand All @@ -115,7 +115,7 @@ export const DetailsSubInfo = ({
if ((componentAndAgentDependencies || []).length === 0) return 'None';
return componentAndAgentDependencies.map((e) => (
<li key={`${type}-dependency-${e}`}>
<Button type="link" onClick={() => navigateToDependency(e)}>
<Button size="large" type="link" onClick={() => navigateToDependency(e)}>
{e}
</Button>
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import { useEffect, useState } from 'react';
import {
Button, Typography, Input, Form,
} from 'antd';
import { Button, Form, Input, Typography } from 'antd';
import PropTypes from 'prop-types';
import {
notifyError,
notifySuccess,
notifyWarning,
} from '@autonolas/frontend-library';
import { useEffect, useState } from 'react';

import { notifyError, notifySuccess, notifyWarning } from '@autonolas/frontend-library';

import { DynamicFieldsForm } from '../../DynamicFieldsForm';
import { addressValidator } from '../../functions';
import { useHelpers } from '../../hooks';
import { DynamicFieldsForm } from '../../DynamicFieldsForm';
import {
checkIfServiceIsWhitelisted,
setOperatorsStatusesRequest,
} from '../utils';
import { checkIfServiceIsWhitelisted, setOperatorsStatusesRequest } from '../utils';

const { Text } = Typography;

Expand All @@ -36,14 +28,9 @@ export const OperatorWhitelist = ({ id, isWhiteListed, setOpWhitelist }) => {
const onCheck = async (values) => {
try {
setIsCheckLoading(true);
const isValid = await checkIfServiceIsWhitelisted(
id,
values.operatorAddress,
);
const isValid = await checkIfServiceIsWhitelisted(id, values.operatorAddress);

const message = `Operator ${values.operatorAddress} is ${
isValid ? '' : 'NOT'
} whitelisted`;
const message = `Operator ${values.operatorAddress} is ${isValid ? '' : 'NOT'} whitelisted`;
if (isValid) notifySuccess(message);
else notifyWarning(message);
} catch (error) {
Expand All @@ -67,20 +54,13 @@ export const OperatorWhitelist = ({ id, isWhiteListed, setOpWhitelist }) => {
<Form.Item
label="Operator Address"
name="operatorAddress"
rules={[
{ required: true, message: 'Please input the address' },
addressValidator,
]}
rules={[{ required: true, message: 'Please input the address' }, addressValidator]}
>
<Input />
</Form.Item>

<Form.Item>
<Button
htmlType="submit"
loading={isCheckLoading}
disabled={!account}
>
<Button size="large" htmlType="submit" loading={isCheckLoading} disabled={!account}>
Check
</Button>
</Form.Item>
Expand Down Expand Up @@ -129,9 +109,7 @@ export const SetOperatorStatus = ({ id, setOpWhitelist }) => {
onSubmit={onSubmit}
submitButtonText="Submit"
/>
<Text type="secondary">
By submitting will instantly enable whitelisting
</Text>
<Text type="secondary">By submitting will instantly enable whitelisting</Text>
</>
);
};
Expand Down
8 changes: 7 additions & 1 deletion apps/autonolas-registry/common-util/Details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ export const Details: FC<DetailsProps> = ({

<div className="right-content">
{canShowUpdateBtn && (
<Button type="primary" ghost onClick={handleUpdate} data-testid="service-update-button">
<Button
size="large"
type="primary"
ghost
onClick={handleUpdate}
data-testid="service-update-button"
>
Update
</Button>
)}
Expand Down
2 changes: 1 addition & 1 deletion apps/autonolas-registry/common-util/Details/styles.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Image, Statistic, Typography } from 'antd';
import styled from 'styled-components';

import { COLOR } from '@autonolas/frontend-library';
import { COLOR } from 'libs/ui-theme/src';

export const DetailsTitle = styled(Typography.Title)`
text-transform: capitalize;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import PropTypes from 'prop-types';
import {
Button, Form, Input, Space, Radio,
} from 'antd';
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, Form, Input, Radio, Space } from 'antd';
import PropTypes from 'prop-types';

import { addressValidator } from '../functions';

Expand Down Expand Up @@ -48,26 +46,22 @@ export const FormList = ({ inputOneLabel, inputTwoLabel, buttonText }) => (
{...field}
label={inputTwoLabel}
name={[field.name, 'status']}
rules={[
{ required: true, message: `Please add ${inputTwoLabel}` },
]}
rules={[{ required: true, message: `Please add ${inputTwoLabel}` }]}
>
<Radio.Group>
<Radio value="true">True</Radio>
<Radio value="false">False</Radio>
</Radio.Group>
</Form.Item>

{fields.length > 1 && (
<MinusCircleOutlined onClick={() => remove(field.name)} />
)}
{fields.length > 1 && <MinusCircleOutlined onClick={() => remove(field.name)} />}
</Space>
))}

<Form.ErrorList errors={errors} />

<Form.Item wrapperCol={{ span: 6 }}>
<Button onClick={() => add()} block icon={<PlusOutlined />}>
<Button size="large" onClick={() => add()} block icon={<PlusOutlined />}>
{buttonText}
</Button>
</Form.Item>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import PropTypes from 'prop-types';
import { Button, Form, Typography } from 'antd';
import PropTypes from 'prop-types';

import { useHelpers } from '../hooks';
import { RegistryForm } from '../TransactionHelpers/RegistryForm';
import { useHelpers } from '../hooks';
import { FormList } from './FormList';
import { DynamicFormContainer } from './styles';

Expand Down Expand Up @@ -30,12 +30,7 @@ export const DynamicFieldsForm = ({

return (
<DynamicFormContainer>
<RegistryForm
form={form}
name="dynamic_form_complex"
onFinish={onFinish}
autoComplete="off"
>
<RegistryForm form={form} name="dynamic_form_complex" onFinish={onFinish} autoComplete="off">
<FormList
inputOneLabel={inputOneLabel}
inputTwoLabel={inputTwoLabel}
Expand All @@ -44,6 +39,7 @@ export const DynamicFieldsForm = ({

<Form.Item>
<Button
size="large"
type="primary"
htmlType="submit"
loading={isLoading}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React, { Fragment, useState } from 'react';
import PropTypes from 'prop-types';
import { Button, Form, Input, Select } from 'antd';
import isNil from 'lodash/isNil';
import { Form, Input, Button, Select } from 'antd';
import PropTypes from 'prop-types';
import React, { Fragment, useState } from 'react';

import { notifyError, notifySuccess } from '@autonolas/frontend-library';

import { HASH_PREFIXES } from 'util/constants';
import { useHelpers } from '../../hooks';

import { notifyWrongNetwork } from '../../functions';
import { getIpfsHashHelper } from './helpers';
import { useHelpers } from '../../hooks';
import { CustomModal } from '../styles';
import { getIpfsHashHelper } from './helpers';

export const FORM_NAME = 'ipfs_creation_form';

Expand Down Expand Up @@ -129,20 +131,19 @@ export const IpfsHashGenerationModal = ({
onCancel={handleCancel}
footer={[
<Fragment key="footer-1">
<Button type="default" onClick={onModalClose}>
<Button size="large" type="default" onClick={onModalClose}>
Cancel
</Button>

<Button
size="large"
form="myForm"
htmlType="submit"
type="primary"
loading={isHashLoading}
onClick={handleHashUpdate ? handleUpdate : handleOk}
>
{handleHashUpdate
? 'Save File & Update Hash'
: 'Save File & Generate Hash'}
{handleHashUpdate ? 'Save File & Update Hash' : 'Save File & Generate Hash'}
</Button>
</Fragment>,
]}
Expand All @@ -160,9 +161,7 @@ export const IpfsHashGenerationModal = ({
<Form.Item
label="Name"
name="name"
rules={[
{ required: true, message: `Please input the name of the ${type}` },
]}
rules={[{ required: true, message: `Please input the name of the ${type}` }]}
>
<Input />
</Form.Item>
Expand Down Expand Up @@ -211,12 +210,8 @@ export const IpfsHashGenerationModal = ({
className="select-before"
onChange={(e) => setHashType(e)}
>
<Select.Option value={HASH_PREFIXES.type1}>
{HASH_PREFIXES.type1}
</Select.Option>
<Select.Option value={HASH_PREFIXES.type2}>
{HASH_PREFIXES.type2}
</Select.Option>
<Select.Option value={HASH_PREFIXES.type1}>{HASH_PREFIXES.type1}</Select.Option>
<Select.Option value={HASH_PREFIXES.type2}>{HASH_PREFIXES.type2}</Select.Option>
</Select>
}
/>
Expand Down
38 changes: 11 additions & 27 deletions apps/autonolas-registry/common-util/List/ListCommon.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useMemo } from 'react';
import PropTypes from 'prop-types';
import Link from 'next/link';
import { Alert, Button } from 'antd';
import { ExportOutlined } from '@ant-design/icons';
import { Alert, Button } from 'antd';
import Link from 'next/link';
import PropTypes from 'prop-types';
import { useMemo } from 'react';

import { EmptyMessage, RegisterFooter } from '../../components/styles';
import { useHelpers } from '../hooks';
Expand All @@ -13,8 +13,7 @@ import { useHelpers } from '../hooks';
* @param {String}
* @returns {Array}
*/
export const convertStringToArray = (str) =>
str ? str.split(',').map((e) => e.trim()) : str;
export const convertStringToArray = (str) => (str ? str.split(',').map((e) => e.trim()) : str);

// ----------- components -----------
export const MyLink = ({ children, href, ...linkProps }) => (
Expand All @@ -27,8 +26,7 @@ MyLink.propTypes = {
href: PropTypes.string.isRequired,
};

export const commaMessage =
'Each comma must be followed by a space ("1, 2" not "1,2").';
export const commaMessage = 'Each comma must be followed by a space ("1, 2" not "1,2").';

export const DependencyLabel = ({ type }) => {
const { isL1Network, isSvm } = useHelpers();
Expand All @@ -42,15 +40,13 @@ export const DependencyLabel = ({ type }) => {
<>
{!isL1Network && (
<>
(Make sure your agent ID is already registered in the Agent
Registry on&nbsp;
(Make sure your agent ID is already registered in the Agent Registry on&nbsp;
{isSvm ? 'Solana' : 'Ethereum'}
)
<br />
</>
)}
Comma-separated list of agent IDs which this service requires. Find
IDs on&nbsp;
Comma-separated list of agent IDs which this service requires. Find IDs on&nbsp;
<MyLink href="/agents">
Agents
<ExportOutlined style={{ width: 14 }} />
Expand Down Expand Up @@ -82,7 +78,7 @@ export const RegisterMessage = ({ handleCancel }) => (
<RegisterFooter>
<p>To mint, connect to wallet</p>
{handleCancel && (
<Button type="default" onClick={handleCancel}>
<Button size="large" type="default" onClick={handleCancel}>
Cancel
</Button>
)}
Expand Down Expand Up @@ -146,14 +142,7 @@ export const AlertSuccess = ({ type, information }) => {

if (!information) return null;

return (
<Alert
message={message}
type="success"
data-testid="alert-info-container"
showIcon
/>
);
return <Alert message={message} type="success" data-testid="alert-info-container" showIcon />;
};
AlertSuccess.propTypes = {
information: PropTypes.shape({}),
Expand All @@ -168,12 +157,7 @@ AlertSuccess.defaultProps = {
export const AlertError = ({ error }) => {
if (!error) return null;
return (
<Alert
message={error.message}
data-testid="alert-error-container"
type="error"
showIcon
/>
<Alert message={error.message} data-testid="alert-error-container" type="error" showIcon />
);
};
AlertError.propTypes = {
Expand Down
Loading
Loading