Skip to content

Commit

Permalink
Added free domains page
Browse files Browse the repository at this point in the history
  • Loading branch information
ahiipsa committed May 18, 2023
1 parent 6e8c5cc commit 8acfc5e
Show file tree
Hide file tree
Showing 7 changed files with 659 additions and 45 deletions.
2 changes: 2 additions & 0 deletions client/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const config = {
sentryDSN: process.env.SENTRY_DSN || '',
backendHost:
process.env.BACKEND_HOST || 'https://mdo-dcobackend-01.t.hmny.io',
freeRentBackendHost:
process.env.FREE_RENT_BACKEND_HOST || 'https://1-country-openapi.fly.dev',
registrar:
process.env.REGISTRAR_RELAYER ||
'https://1ns-registrar-relayer.hiddenstate.xyz',
Expand Down
7 changes: 6 additions & 1 deletion client/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { lazy, Suspense } from 'react'
import { Routes, Route } from 'react-router-dom'
import { HomePage } from './routes/home/HomePage'
import { HomePageLoader } from './routes/home/components/HomePageLoader'
import ClaimFreePage from './routes/claimFree/ClaimFreePage'

const StatsPage = lazy(
() => import(/* webpackChunkName: "Others" */ './routes/stats/Stats')
Expand All @@ -10,7 +11,10 @@ const StatusPage = lazy(
() => import(/* webpackChunkName: "Others" */ './routes/status/Status')
)
const AffiliateSalesPage = lazy(
() => import(/* webpackChunkName: "Others" */ './routes/affiliate/AffiliateStatus')
() =>
import(
/* webpackChunkName: "Others" */ './routes/affiliate/AffiliateStatus'
)
)
const WaitingRoom = lazy(
() =>
Expand Down Expand Up @@ -44,6 +48,7 @@ const AppRoutes = () => {
<Route path="stats/" element={<StatsPage />} />
<Route path="affiliatesales/" element={<AffiliateSalesPage />} />
<Route path="details/" element={<DetailsPage />} />
<Route path="claim-free" element={<ClaimFreePage />} />
<Route path="live/" element={<LiveStreamPage />} />
<Route path="*" element={<HomePage />} />
</Routes>
Expand Down
47 changes: 34 additions & 13 deletions client/src/api/mainApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export interface Link {
export interface HtmlWidget {
id: string
attributes: {
any: string;
};
title: string;
owner: string;
any: string
}
title: string
owner: string
}

export const mainApi = {
Expand All @@ -50,6 +50,25 @@ export const mainApi = {
})
},

rentDomainForFree: ({
name,
owner,
freeRentKey,
}: {
name: string
owner: string
freeRentKey: string
}) => {
return axios.post<{ transactionHash: string }>(
`${config.freeRentBackendHost}/rent`,
{
domainName: name,
ownerAddress: owner,
freeRentKey,
}
)
},

loadDomain: async ({ domain }: { domain: string }) => {
const response = await base.get<{ data: Domain }>(`/domains/${domain}`)
return response.data.data
Expand Down Expand Up @@ -96,27 +115,29 @@ export const mainApi = {
return base.post<{ data: Link }>(`/links/`, {
domainName,
linkId,
url
url,
})
},

pinLink: (id: string, isPinned: boolean) => base.post<{ data: Link }>(`/links/pin`, {
id,
isPinned
}),
pinLink: (id: string, isPinned: boolean) =>
base.post<{ data: Link }>(`/links/pin`, {
id,
isPinned,
}),

getLinks: (domainName: string) => base.get<{ data: Link[] }>(`/links?domain=${domainName}`),
getLinks: (domainName: string) =>
base.get<{ data: Link[] }>(`/links?domain=${domainName}`),

deleteLink: (id: string) => base.delete<{ data: string }>(`/links/${id}`),

addHtmlWidget: (attributes: { any: string }, owner = '', title = '') => {
return base.post<HtmlWidget>(`/widgets/`, {
attributes,
owner,
title
title,
})
},

getHtmlWidget: (id: string) => base.get<HtmlWidget>(`/widgets/${id}`),

auth: async ({
Expand Down Expand Up @@ -144,4 +165,4 @@ export const mainApi = {
.then((result) => result.status === 200)
.catch(() => false)
},
}
}
33 changes: 33 additions & 0 deletions client/src/components/TextInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react'
import { TextInput as GrommetTextInput } from 'grommet/components/TextInput'

import { palette } from '../constants'
import styled, { css } from 'styled-components'

export const TextInput = styled(GrommetTextInput)<{ isValid?: boolean }>`
border-radius: 20px;
box-shadow: none;
font-weight: 400;
border: 1px solid #dfe1e5;
color: #333437;
transition: border-color 250ms, box-shadow 250ms;
&:focus,
&:hover {
background-color: #fff;
box-shadow: 0 1px 5px rgb(32 33 36 / 26%);
border-color: rgba(223, 225, 229, 0);
}
${(props) =>
!props.isValid &&
css`
border-color: ${palette.PinkRed};
&:hover,
&:focus {
border-color: ${palette.LightRed};
box-shadow: 0 1px 6px rgb(255 77 79 / 26%);
}
`}
`
34 changes: 3 additions & 31 deletions client/src/components/search-input/SearchInput.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
import React, { useRef } from 'react'
import { Box } from 'grommet/components/Box'
import { TextInput, TextInputProps } from 'grommet/components/TextInput'
import { TextInputProps } from 'grommet/components/TextInput'

import { FormClose } from 'grommet-icons/icons/FormClose'
import styled, { css } from 'styled-components'
import { palette } from '../../constants'

const TextInputWrapper = styled(TextInput)<{ isValid?: boolean }>`
border-radius: 20px;
box-shadow: none;
font-weight: 400;
border: 1px solid #dfe1e5;
color: #333437;
transition: border-color 250ms, box-shadow 250ms;
&:focus,
&:hover {
background-color: #fff;
box-shadow: 0 1px 5px rgb(32 33 36 / 26%);
border-color: rgba(223, 225, 229, 0);
}
${(props) =>
!props.isValid &&
css`
border-color: ${palette.PinkRed};
&:hover,
&:focus {
border-color: ${palette.LightRed};
box-shadow: 0 1px 6px rgb(255 77 79 / 26%);
}
`}
`
import { TextInput } from '../TextInput'

const InputSuffix = styled(Box)`
position: absolute;
Expand Down Expand Up @@ -105,7 +77,7 @@ export const SearchInput = (props: SearchInputProps) => {
justify={'center'}
paddingLeft={props.icon ? null : '24px'}
>
<TextInputWrapper {...inputProps} />
<TextInput {...inputProps} />
{allowClear && !props.disabled && props.value && (
<InputSuffix>
<FormClose onClick={clearValue} />
Expand Down
1 change: 1 addition & 0 deletions client/src/custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ declare module 'react-video-thumbnail-image'
declare module 'react-fb-image-video-grid'
declare module 'grommet-icons/icons/FormClose'
declare module 'grommet-icons/icons/FormSearch'
declare module 'grommet-icons/icons/User'
declare module 'use-lodash-debounce'
Loading

0 comments on commit 8acfc5e

Please sign in to comment.