Display DNS deployment URLs in overview section #21
@ -22,8 +22,8 @@ export const createResolvers = async (service: Service): Promise<any> => {
|
||||
return service.getOrganizationsByUserId(context.user);
|
||||
},
|
||||
|
||||
project: async (_: any, { projectId }: { projectId: string }) => {
|
||||
return service.getProjectById(projectId);
|
||||
project: async (_: any, { projectId }: { projectId: string }, context: any) => {
|
||||
return service.getProjectById(context.user, projectId);
|
||||
},
|
||||
|
||||
projectsInOrganization: async (
|
||||
|
@ -407,8 +407,13 @@ export class Service {
|
||||
return dbOrganizations;
|
||||
}
|
||||
|
||||
async getProjectById(projectId: string): Promise<Project | null> {
|
||||
async getProjectById(user: User, projectId: string): Promise<Project | null> {
|
||||
const dbProject = await this.db.getProjectById(projectId);
|
||||
|
||||
if (dbProject && dbProject.owner.id !== user.id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return dbProject;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"id": "2379cf1f-a232-4ad2-ae14-4d881131cc26",
|
||||
"name": "Snowball Tools",
|
||||
"slug": "snowball-tools-1"
|
||||
"name": "Deploy Tools",
|
||||
"slug": "deploy-tools"
|
||||
},
|
||||
{
|
||||
"id": "7eb9b3eb-eb74-4b53-b59a-69884c82a7fb",
|
||||
|
@ -515,7 +515,7 @@ const Configure = () => {
|
||||
<Button
|
||||
{...buttonSize}
|
||||
type="submit"
|
||||
disabled={isLoading}
|
||||
disabled={isLoading || !selectedDeployer || !selectedAccount}
|
||||
rightIcon={
|
||||
isLoading ? (
|
||||
<LoadingIcon className="animate-spin" />
|
||||
@ -538,7 +538,9 @@ const Configure = () => {
|
||||
<Button
|
||||
{...buttonSize}
|
||||
type="submit"
|
||||
disabled={isLoading || isPaymentLoading}
|
||||
disabled={
|
||||
isLoading || isPaymentLoading || !selectedAccount
|
||||
}
|
||||
rightIcon={
|
||||
isLoading || isPaymentLoading ? (
|
||||
<LoadingIcon className="animate-spin" />
|
||||
|
@ -10,7 +10,6 @@ import {
|
||||
import SignClient from '@walletconnect/sign-client';
|
||||
import { getSdkError } from '@walletconnect/utils';
|
||||
import { SessionTypes } from '@walletconnect/types';
|
||||
import { StargateClient } from '@cosmjs/stargate';
|
||||
|
||||
import { walletConnectModal } from '../utils/web3modal';
|
||||
import {
|
||||
@ -46,10 +45,6 @@ export const WalletConnectClientProvider = ({
|
||||
|
||||
const isSignClientInitializing = useRef<boolean>(false);
|
||||
|
||||
const createCosmosClient = useCallback(async (endpoint: string) => {
|
||||
return await StargateClient.connect(endpoint);
|
||||
}, []);
|
||||
|
||||
const onSessionConnect = useCallback(async (session: SessionTypes.Struct) => {
|
||||
setSession(session);
|
||||
}, []);
|
||||
@ -166,6 +161,11 @@ export const WalletConnectClientProvider = ({
|
||||
if (!session) {
|
||||
return;
|
||||
}
|
||||
if (!session.namespaces['cosmos']) {
|
||||
console.log('Accounts for cosmos namespace not found');
|
||||
return;
|
||||
}
|
||||
|
||||
const cosmosAddresses = session.namespaces['cosmos'].accounts;
|
||||
|
||||
const cosmosAccounts = cosmosAddresses.map((address) => ({
|
||||
@ -178,7 +178,7 @@ export const WalletConnectClientProvider = ({
|
||||
};
|
||||
|
||||
populateAccounts();
|
||||
}, [session, createCosmosClient]);
|
||||
}, [session]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!signClient) {
|
||||
|
@ -92,9 +92,13 @@ const Id = () => {
|
||||
Open repo
|
||||
</Button>
|
||||
</Link>
|
||||
{(project.deployments.length > 0) &&
|
||||
<Link to={`https://${project.name.toLowerCase()}.${project.deployments[0].deployer.baseDomain}`}>
|
||||
<Button {...buttonSize} className="h-11 transition-colors">
|
||||
Go to app
|
||||
</Button>
|
||||
</Link>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<WavyBorder />
|
||||
|
@ -180,14 +180,18 @@ const OverviewTabPanel = () => {
|
||||
|
||||
{/* DEPLOYMENT */}
|
||||
<OverviewInfo label="Deployment URL" icon={<CursorBoxIcon />}>
|
||||
{project.deployments &&
|
||||
project.deployments.length > 0 &&
|
||||
project.deployments.map((deployment) => (
|
||||
<div className="flex gap-2 items-center">
|
||||
<Link to="#">
|
||||
<Link to={`https://${project.name.toLowerCase()}.${deployment.deployer.baseDomain}`}>
|
||||
<span className="text-controls-primary group hover:border-controls-primary transition-colors border-b border-b-transparent flex gap-2 items-center text-sm tracking-tight">
|
||||
{liveDomain?.name}{' '}
|
||||
{`https://${project.name.toLowerCase()}.${deployment.deployer.baseDomain}`}
|
||||
<LinkIcon className="group-hover:rotate-45 transition-transform" />
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
))}
|
||||
</OverviewInfo>
|
||||
|
||||
{/* DEPLOYMENT DATE */}
|
||||
|
@ -17,7 +17,7 @@ const meta: Meta<typeof AddEnvironmentVariableRow> = {
|
||||
pathParams: { userId: 'me' },
|
||||
},
|
||||
routing: {
|
||||
path: '/snowball-tools-1/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings',
|
||||
path: '/deploy-tools/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings',
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
@ -17,7 +17,7 @@ const meta: Meta<typeof Config> = {
|
||||
pathParams: { userId: 'me' },
|
||||
},
|
||||
routing: {
|
||||
path: '/snowball-tools-1/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings/domains/add/config',
|
||||
path: '/deploy-tools/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings/domains/add/config',
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
@ -18,7 +18,7 @@ const meta: Meta<typeof DeleteProjectDialog> = {
|
||||
pathParams: { userId: 'me' },
|
||||
},
|
||||
routing: {
|
||||
path: '/snowball-tools-1/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings',
|
||||
path: '/deploy-tools/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings',
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
@ -17,7 +17,7 @@ const meta: Meta<typeof SetupDomain> = {
|
||||
pathParams: { userId: 'me' },
|
||||
},
|
||||
routing: {
|
||||
path: '/snowball-tools-1/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings/domains',
|
||||
path: '/deploy-tools/projects/6bb3bec2-d71b-4fc0-9e32-4767f68668f4/settings/domains',
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user