Skip to content
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

Include all . characters in domain name #375

Closed
wants to merge 1 commit into from
Closed
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
29 changes: 13 additions & 16 deletions app/components/dns-record/dns-record-name.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import { Flex, Text } from '@chakra-ui/react';

interface DnsRecordNameProps {
name: string;
subdomain: string;
baseDomain: string;
}

const DnsRecordName = ({ name }: DnsRecordNameProps) => {
const [nameBase, ...restOfName] = name.split('.');

return (
<Flex alignItems="flex-end" flexDirection="row">
<Text>
<Text as="span" sx={{ fontWeight: 'medium' }}>
{nameBase}
</Text>
<Text as="span" color="gray.500">
.{restOfName}
</Text>
const DnsRecordName = ({ subdomain, baseDomain }: DnsRecordNameProps) => (
<Flex alignItems="flex-end" flexDirection="row">
<Text>
<Text as="span" sx={{ fontWeight: 'medium' }}>
{subdomain}
</Text>
<Text as="span" color="gray.500">
.{baseDomain}
</Text>
</Flex>
);
};
</Text>
</Flex>
);

export default DnsRecordName;
8 changes: 6 additions & 2 deletions app/components/domains-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import RecordDeleteAlertDialog from './record-delete-alert-dialog';

import { Form, useNavigate, useTransition } from '@remix-run/react';
import DnsRecordName from './dns-record/dns-record-name';
import { useUser } from '~/utils';

interface DomainsTableProps {
domains: Record[];
Expand All @@ -37,6 +38,7 @@ interface DomainsTableProps {
export default function DomainsTable(props: DomainsTableProps) {
const { domains } = props;

const { baseDomain } = useUser();
const toast = useToast();
const navigate = useNavigate();
const transition = useTransition();
Expand Down Expand Up @@ -143,14 +145,16 @@ export default function DomainsTable(props: DomainsTableProps) {
<Td>{renderDomainStatus(domain.status)}</Td>
<Td>
<Flex justifyContent="space-between" alignItems="center">
<DnsRecordName name={domain.subdomain} />
<DnsRecordName subdomain={domain.subdomain} baseDomain={baseDomain} />
<Tooltip label="Copy name to clipboard">
<IconButton
icon={<CopyIcon color="black" boxSize="5" />}
aria-label="Refresh domain"
variant="ghost"
ml="2"
onClick={() => onCopyNameToClipboard(domain.subdomain)}
onClick={() =>
onCopyNameToClipboard(`${domain.subdomain}.${baseDomain}`)
}
/>
</Tooltip>
</Flex>
Expand Down