8000 feat(tangle-cloud): List operators in the Operators page by devpavan04 · Pull Request #3005 · tangle-network/dapp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(tangle-cloud): List operators in the Operators page #3005

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

Merged
merged 7 commits into from
May 17, 2025
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,6 @@ libs/tangle-shared-ui/src/graphql/
vitest.config.*.timestamp*

# React Scan reports
reports/
reports/
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"files.associations": {
"*.css": "tailwindcss"
},
"eslint.useFlatConfig": true
"eslint.useFlatConfig": true,
"nxConsole.generateAiAgentRules": true
}
10 changes: 6 additions & 4 deletions apps/tangle-cloud/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { PagePath } from '../types';
import RegistrationReview from '../pages/registrationReview/page';
import RegistrationLayout from '../pages/registrationReview/layout';
import DeployPage from '../pages/blueprints/[id]/deploy/page';
import OperatorsPage from '../pages/operators/page';
import OperatorsLayout from '../pages/operators/layout';
import NotFoundPage from '../pages/notFound';
import { FC } from 'react';

Expand Down Expand Up @@ -72,11 +74,11 @@ const App: FC = () => {
/>

<Route
path={PagePath.BLUEPRINTS_REGISTRATION_REVIEW}
path={PagePath.OPERATORS}
element={
<RegistrationLayout>
<RegistrationReview />
</RegistrationLayout>
<OperatorsLayout>
<OperatorsPage />
</OperatorsLayout>
}
/>

Expand Down
4 changes: 2 additions & 2 deletions apps/tangle-cloud/src/constants/links.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// TODO: Update this link after the pricing page is ready
export const OPERATOR_PRICING_URL = 'https://docs.tangle.tools';
// TODO: Update this link after the operator RPC page is ready
export const OPERATOR_RPC_URL = 'https://docs.tangle.tools';
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import { zodResolver } from '@hookform/resolvers/zod';
import { Blueprint } from '@tangle-network/tangle-shared-ui/types/blueprint';
import { Form } from '@tangle-network/ui-components/components/form';
import {
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage,
} from '@tangle-network/ui-components/components/form';
import { Input } from '@tangle-network/ui-components';
import {
ModalBody,
ModalContent,
ModalHeader,
} from '@tangle-network/ui-components/components/Modal';
import { FC, useCallback } from 'react';
import { useForm } from 'react-hook-form';
import {
blueprintFormSchema,
BlueprintFormSchema,
BlueprintFormResult,
} from './types';
import FormActions from './FormActions';

type Props = {
onOpenChange: (isOpen: boolean) => void;
blueprints: Blueprint[];
onSubmit: (result: BlueprintFormResult) => void;
};

const ConfigureBlueprintModal: FC<Props> = ({
onOpenChange,
blueprints,
onSubmit,
}) => {
const form = useForm<BlueprintFormSchema>({
resolver: zodResolver(blueprintFormSchema),
defaultValues: {
rpcUrl: '',
},
});

const handleClose = useCallback(() => {
onOpenChange(false);
form.reset();
}, [form, onOpenChange]);

const handleSubmit = useCallback(
(values: BlueprintFormSchema) => {
handleClose();
onSubmit({
values,
});
},
[handleClose, onSubmit],
);

return (
<ModalContent
size="md"
=> event.preventDefault()}
title="Configure Blueprint"
description={`Configure the RPC URL for ${blueprints.length} selected blueprint${blueprints.length > 1 ? 's' : ''}`}
>
<ModalHeader className="pb-4">
Configure Blueprint{blueprints.length > 1 ? 's' : ''}
</ModalHeader>

<ModalBody className="p-6">
<Form {...form}>
<form
>
className="space-y-6"
>
{blueprints.length > 1 ? (
<div className="space-y-4">
<p className="text-mono-120 dark:text-mono-100">
The following blueprints will be configured with the same RPC
URL:
</p>
<ul className="list-disc pl-5 space-y-2">
{blueprints.map((blueprint) => (
<li
key={blueprint.id}
className="text-mono-120 dark:text-mono-100"
>
{blueprint.name}
</li>
))}
</ul>
</div>
) : null}

<FormField
control={form.control}
name="rpcUrl"
render={({ field }) => (
<FormItem>
<FormLabel>Enter RPC URL</FormLabel>
<FormControl>
<Input
id="rpc-url-input"
placeholder="https://rpc.example.com"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>

<FormActions />
</form>
</Form>
</ModalBody>
</ModalContent>
);
};

export default ConfigureBlueprintModal;
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Button from '@tangle-network/ui-components/components/buttons/Button';
import { ModalFooter } from '@tangle-network/ui-components/components/Modal';
import { OPERATOR_PRICING_URL } from '../../../constants/links';
import { OPERATOR_RPC_URL } from '../../../constants/links';

const FormActions = () => {
return (
<ModalFooter className="px-0">
<Button
href={OPERATOR_PRICING_URL}
href={OPERATOR_RPC_URL}
target="_blank"
className="flex-1 max-w-none"
variant="secondary"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ConfigureBlueprintModal from './ConfigureBlueprintModal';

export default ConfigureBlueprintModal;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { z } from 'zod';

export const blueprintFormSchema = z.object({
rpcUrl: z.string().url({ message: 'Please enter a valid URL' }).optional(),
});

export type BlueprintFormSchema = z.infer<typeof blueprintFormSchema>;

export type BlueprintFormResult = {
values: BlueprintFormSchema;
};

This file was deleted.

Loading
Loading
0