diff --git a/app/routes/_data.dns._index/dialogs/dns.tsx b/app/routes/_data.dns._index/dialogs/dns.tsx new file mode 100644 index 0000000..28949dc --- /dev/null +++ b/app/routes/_data.dns._index/dialogs/dns.tsx @@ -0,0 +1,121 @@ +import { Form, useSubmit } from '@remix-run/react' +import { useMemo, useState } from 'react' + +import Code from '~/components/Code' +import Dialog from '~/components/Dialog' +import TextField from '~/components/TextField' +import { cn } from '~/utils/cn' + +interface Props { + records: { name: string, type: 'A', value: string }[] +} + +export default function AddDNS({ records }: Props) { + const submit = useSubmit() + const [name, setName] = useState('') + const [ip, setIp] = useState('') + + const isDuplicate = useMemo(() => { + if (name.length === 0 || ip.length === 0) return false + const lookup = records.find(record => record.name === name) + if (!lookup) return false + + return lookup.value === ip + }, [records, name, ip]) + + return ( + + ) +} diff --git a/app/routes/_data.dns._index/dns.tsx b/app/routes/_data.dns._index/dns.tsx new file mode 100644 index 0000000..5eca27e --- /dev/null +++ b/app/routes/_data.dns._index/dns.tsx @@ -0,0 +1,137 @@ +import { useSubmit } from '@remix-run/react' +import { useState } from 'react' +import { Button } from 'react-aria-components' + +import Code from '~/components/Code' +import Link from '~/components/Link' +import Switch from '~/components/Switch' +import TableList from '~/components/TableList' +import { cn } from '~/utils/cn' + +import AddDNS from './dialogs/dns' + +interface Props { + records: { name: string, type: 'A', value: string }[] + isDisabled: boolean +} + +export default function DNS({ records, isDisabled }: Props) { + const submit = useSubmit() + + return ( +
+ Headscale supports adding custom DNS records to your Tailnet.
+ As of now, only
+ {' '}
+ A
+ {' '}
+ records are supported.
+ {' '}
+
+ Learn More
+
+
+ No DNS records found +
+{record.type}
+{record.name}
+{record.value}
+