Skip to content

Commit 108ff8e

Browse files
committed
Merge branch 'develop'
2 parents 5243454 + 3218dd0 commit 108ff8e

File tree

20 files changed

+239
-200
lines changed

20 files changed

+239
-200
lines changed

src/components/auth/LoginCard.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { PoAIManagerAbi } from '@blockchain/PoAIManager';
22
import { Button } from '@heroui/button';
3-
import { config, getDevAddress, isUsingDevAddress } from '@lib/config';
3+
import { config, isUsingDevAddress } from '@lib/config';
44
import { BlockchainContextType, useBlockchainContext } from '@lib/contexts/blockchain';
55
import { DeploymentContextType, useDeploymentContext } from '@lib/contexts/deployment';
66
import { getShortAddressOrHash, isZeroAddress } from '@lib/utils';
@@ -132,14 +132,16 @@ export default function LoginCard({ oraclesCount }: { oraclesCount: number }) {
132132
<Button
133133
color="primary"
134134
onPress={() => {
135-
if (isUsingDevAddress) {
136-
console.log(
137-
`Using dev address ${getShortAddressOrHash(getDevAddress().address, 4, true)}, bypassing login`,
138-
);
139-
setFetchAppsRequired(false); // Bypass
140-
} else {
141-
fetchApps();
142-
}
135+
// if (isUsingDevAddress) {
136+
// console.log(
137+
// `Using dev address ${getShortAddressOrHash(getDevAddress().address, 4, true)}, bypassing login`,
138+
// );
139+
// setFetchAppsRequired(false); // Bypass
140+
// } else {
141+
// fetchApps();
142+
// }
143+
144+
fetchApps();
143145
}}
144146
isLoading={isFetchingApps}
145147
isDisabled={!hasContract && !isUsingDevAddress}

src/components/deeploys/DraftCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { RiDeleteBinLine } from 'react-icons/ri';
1212
import { Link } from 'react-router-dom';
1313

1414
export default function DraftCard({ project }: { project: DraftProject }) {
15-
const confirm = useInteractionContext() as InteractionContextType;
15+
const { confirm } = useInteractionContext() as InteractionContextType;
1616

1717
const jobs: DraftJob[] | undefined = useLiveQuery(
1818
() => db.jobs.where('projectHash').equals(project.projectHash).toArray(),

src/components/draft/DraftOverview.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ import ServiceDraftJobsList from './job-lists/ServiceDraftJobsList';
1818

1919
export default function DraftOverview({
2020
project,
21-
jobs,
21+
draftJobs,
2222
projectIdentity,
2323
}: {
2424
project: DraftProject;
25-
jobs: DraftJob[] | undefined;
25+
draftJobs: DraftJob[] | undefined;
2626
projectIdentity: React.ReactNode;
2727
}) {
28-
const confirm = useInteractionContext() as InteractionContextType;
28+
const { confirm } = useInteractionContext() as InteractionContextType;
2929
const navigate = useNavigate();
3030

3131
useEffect(() => {
@@ -66,27 +66,27 @@ export default function DraftOverview({
6666
</div>
6767
</ActionButton>
6868

69-
<PaymentButton isDisabled={jobs?.length === 0} />
69+
<PaymentButton isDisabled={draftJobs?.length === 0} />
7070
</div>
7171
</div>
7272

7373
{/* Stats */}
74-
<DraftStats jobs={jobs} />
74+
<DraftStats jobs={draftJobs} />
7575

7676
{/* Add Job */}
7777
<AddJobCard />
7878

7979
{/* Jobs */}
80-
{!!jobs && !!jobs.length && (
80+
{!!draftJobs && !!draftJobs.length && (
8181
<>
82-
{jobs.filter((job) => job.jobType === JobType.Generic).length > 0 && (
83-
<GenericDraftJobsList jobs={jobs.filter((job) => job.jobType === JobType.Generic)} />
82+
{draftJobs.filter((job) => job.jobType === JobType.Generic).length > 0 && (
83+
<GenericDraftJobsList jobs={draftJobs.filter((job) => job.jobType === JobType.Generic)} />
8484
)}
85-
{jobs.filter((job) => job.jobType === JobType.Native).length > 0 && (
86-
<NativeDraftJobsList jobs={jobs.filter((job) => job.jobType === JobType.Native)} />
85+
{draftJobs.filter((job) => job.jobType === JobType.Native).length > 0 && (
86+
<NativeDraftJobsList jobs={draftJobs.filter((job) => job.jobType === JobType.Native)} />
8787
)}
88-
{jobs.filter((job) => job.jobType === JobType.Service).length > 0 && (
89-
<ServiceDraftJobsList jobs={jobs.filter((job) => job.jobType === JobType.Service)} />
88+
{draftJobs.filter((job) => job.jobType === JobType.Service).length > 0 && (
89+
<ServiceDraftJobsList jobs={draftJobs.filter((job) => job.jobType === JobType.Service)} />
9090
)}
9191
</>
9292
)}

src/components/jobs/JobFormWrapper.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { z } from 'zod';
2424

2525
const STEPS = ['Project', 'Specifications', 'Payment & Duration', 'Deployment'];
2626

27-
function JobFormWrapper() {
27+
function JobFormWrapper({ projectName, draftJobsCount }) {
2828
const { projectHash } = useParams();
2929
const { step, jobType, setJobType } = useDeploymentContext() as DeploymentContextType;
3030

@@ -128,6 +128,22 @@ function JobFormWrapper() {
128128
}
129129
}, [jobType, form]);
130130

131+
useEffect(() => {
132+
if (jobType && form) {
133+
setDefaultJobAlias(jobType);
134+
}
135+
}, [jobType, form]);
136+
137+
const setDefaultJobAlias = (jobType: JobType) => {
138+
if (jobType === JobType.Service) {
139+
// Service jobs already set their own alias using the selected db system
140+
return;
141+
}
142+
143+
const defaultJobAlias = `${projectName}-${jobType}-app-${draftJobsCount + 1}`.toLowerCase();
144+
form.setValue('deployment.jobAlias', defaultJobAlias);
145+
};
146+
131147
const onSubmit = async (data: z.infer<typeof jobSchema>) => {
132148
console.log('[JobFormWrapper] onSubmit', data);
133149

src/components/layout/Content.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ function Content() {
3030
<div className="col gap-1.5">
3131
{!!title && (
3232
<div className="row">
33-
<div className="text-[26px] font-bold leading-none lg:text-[28px]">{title}</div>
33+
<div className="text-[26px] leading-none font-bold lg:text-[28px]">{title}</div>
3434
</div>
3535
)}
3636

3737
{!!description && <div className="text-base text-slate-500 lg:text-lg">{description}</div>}
3838
</div>
3939

4040
<div className="flex">
41-
<ConnectKitButton showBalance />
41+
<ConnectKitButton />
4242
</div>
4343
</div>
4444

src/components/project/ProjectOverview.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,17 @@ import ServiceRunningJobsList from './job-lists/ServiceRunningJobsList';
1818
import ProjectStats from './ProjectStats';
1919

2020
export default function ProjectOverview({
21-
projectName,
2221
runningJobs,
2322
draftJobs,
2423
projectIdentity,
2524
}: {
26-
projectName: string | undefined;
2725
runningJobs: RunningJobWithAlias[] | undefined;
2826
draftJobs: DraftJob[] | undefined;
2927
projectIdentity: React.ReactNode;
3028
}) {
3129
const [selectedTab, setSelectedTab] = useState<'runningJobs' | 'draftJobs'>('runningJobs');
3230
const [runningJobsWithResources, setRunningJobsWithResources] = useState<RunningJobWithResources[]>([]);
3331

34-
useEffect(() => {
35-
console.log({ projectName, runningJobs, draftJobs });
36-
}, [runningJobs, draftJobs]);
37-
3832
useEffect(() => {
3933
const runningJobsWithResources: RunningJobWithResources[] = _(runningJobs)
4034
.map((job) => {

src/components/tunnels/TunnelCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Link, useNavigate } from 'react-router-dom';
1414

1515
export default function TunnelCard({ tunnel, fetchTunnels }: { tunnel: Tunnel; fetchTunnels: () => Promise<void> }) {
1616
const { tunnelingSecrets, openTunnelRenameModal, openTunnelTokenModal } = useTunnelsContext() as TunnelsContextType;
17-
const confirm = useInteractionContext() as InteractionContextType;
17+
const { confirm } = useInteractionContext() as InteractionContextType;
1818

1919
const navigate = useNavigate();
2020

src/components/tunnels/TunnelingSecretsForm.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { zodResolver } from '@hookform/resolvers/zod';
22
import { addSecrets } from '@lib/api/tunnels';
33
import { getDevAddress, isUsingDevAddress } from '@lib/config';
4+
import { InteractionContextType, useInteractionContext } from '@lib/contexts/interaction';
45
import { buildDeeployMessage } from '@lib/deeploy-utils';
56
import { addSecretsSchema } from '@schemas/secrets';
67
import { SlateCard } from '@shared/cards/SlateCard';
@@ -22,6 +23,8 @@ export default function TunnelingSecretsForm({
2223
onSuccess: (secrets: TunnelingSecrets) => void;
2324
wrapInCard?: boolean;
2425
}) {
26+
const { openSignMessageModal, closeSignMessageModal } = useInteractionContext() as InteractionContextType;
27+
2528
const { address } = isUsingDevAddress ? getDevAddress() : useAccount();
2629
const { signMessageAsync } = useSignMessage();
2730

@@ -51,11 +54,15 @@ export default function TunnelingSecretsForm({
5154
cloudflare_domain: data.domain,
5255
});
5356

57+
openSignMessageModal();
58+
5459
const signature = await signMessageAsync({
5560
account: address,
5661
message,
5762
});
5863

64+
closeSignMessageModal();
65+
5966
const payload = {
6067
nonce,
6168
EE_ETH_SIGN: signature,
@@ -80,9 +87,16 @@ export default function TunnelingSecretsForm({
8087
} else {
8188
throw new Error(response.result?.error);
8289
}
83-
} catch (error) {
90+
} catch (error: any) {
8491
console.error('[TunnelingSecretsForm] Error adding secrets:', error);
85-
toast.error('Failed to add secrets, please try again.');
92+
93+
if (error?.message.includes('User rejected the request')) {
94+
toast.error('Please sign the message to continue.');
95+
} else {
96+
toast.error('Failed to add secrets, please try again.');
97+
}
98+
99+
closeSignMessageModal();
86100
} finally {
87101
setLoading(false);
88102
}

0 commit comments

Comments
 (0)