Skip to content

Commit

Permalink
feat(app-page-builder): remove domain input
Browse files Browse the repository at this point in the history
set a default domain
  • Loading branch information
Ashu96 authored and adrians5j committed Jun 30, 2020
1 parent 265644d commit bcc41d0
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions packages/app-page-builder/src/admin/plugins/install.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useCallback } from "react";
import React, { useState, useCallback, useMemo } from "react";
import gql from "graphql-tag";
import { useApolloClient } from "react-apollo";
import { i18n } from "@webiny/app/i18n";
Expand Down Expand Up @@ -55,6 +55,13 @@ const installationSteps = {
5: t`Finalizing...`
};

const getCurrentDomain = () => {
const isLocalHost = window.location.origin.includes("localhost");
const localDomain = "http://localhost:3000";

return isLocalHost ? localDomain : window.location.origin;
};

const PBInstaller = ({ onInstalled }) => {
const client = useApolloClient();
const [loading, setLoading] = useState(false);
Expand Down Expand Up @@ -92,7 +99,7 @@ const PBInstaller = ({ onInstalled }) => {
);

return (
<Form onSubmit={onSubmit} data={{ domain: window.location.origin }} submitOnEnter>
<Form onSubmit={onSubmit} data={{ domain: getCurrentDomain() }} submitOnEnter>
{({ Bind, submit }) => (
<SimpleForm>
{loading && <CircularProgress label={installationSteps[installationStep]} />}
Expand All @@ -116,14 +123,6 @@ const PBInstaller = ({ onInstalled }) => {
/>
</Bind>
</Cell>
<Cell span={12}>
<Bind name="domain" validators={validation.create("required,url")}>
<Input
label={t`Domain`}
placeholder={"https://www.mysite.com"}
/>
</Bind>
</Cell>
</Grid>
</SimpleFormContent>
<SimpleFormFooter>
Expand Down

0 comments on commit bcc41d0

Please sign in to comment.