-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
123 changed files
with
10,009 additions
and
3,699 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Used only in development environments | ||
# To override locally, make a copy called `.env.development.local` | ||
# Refer: https://nextjs.org/docs/basic-features/environment-variables | ||
|
||
NEXT_PUBLIC_OONI_API=https://api.dev.ooni.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Used only in producition | ||
# To override locally, make a copy called `.env.production.local` | ||
# Refer: https://nextjs.org/docs/basic-features/environment-variables | ||
|
||
NEXT_PUBLIC_OONI_API=https://api.ooni.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Used in test/CI environemnts | ||
# To override locally, make a copy called `.env.test.local` | ||
# Refer: https://nextjs.org/docs/basic-features/environment-variables | ||
|
||
NEXT_PUBLIC_OONI_API=https://api.dev.ooni.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm install -g yarn && yarn | ||
- name: Install Playwright Browsers | ||
run: yarn playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: yarn playwright test | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json", | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true | ||
} | ||
}, | ||
"formatter": { | ||
"indentStyle": "space", | ||
"indentWidth": 2 | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"semicolons": "asNeeded", | ||
"quoteStyle": "single" | ||
} | ||
}, | ||
"files": { | ||
"ignore": [".next/", "scripts/", "public/", "config/"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { MdOutlineInventory2 } from 'react-icons/md' | ||
import { useIntl } from 'react-intl' | ||
|
||
const ArchivedTag = () => { | ||
const intl = useIntl() | ||
return ( | ||
<div className="inline-block"> | ||
<div className="flex uppercase tracking-wide bg-gray-600 text-white text-xs font-bold px-2 py-1 items-center rounded gap-1"> | ||
<span>{intl.formatMessage({ id: 'ArchivedTag.Expired' })}</span> | ||
<MdOutlineInventory2 /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default ArchivedTag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { useState } from 'react' | ||
import { MdOutlineCheckCircle, MdOutlineContentCopy } from 'react-icons/md' | ||
|
||
type Code = { | ||
text: string | ||
} | ||
|
||
const Code = ({ text }: Code) => { | ||
const [isCopied, setIsCopied] = useState(false) | ||
|
||
const copyTextToClipboard = async (text: string) => { | ||
if ('clipboard' in navigator) { | ||
return await navigator.clipboard.writeText(text) | ||
} | ||
return document.execCommand('copy', true, text) | ||
} | ||
|
||
const handleCopyClick = () => { | ||
copyTextToClipboard(text) | ||
.then(() => { | ||
setIsCopied(true) | ||
setTimeout(() => { | ||
setIsCopied(false) | ||
}, 2000) | ||
}) | ||
.catch((err) => { | ||
console.log(err) | ||
}) | ||
} | ||
|
||
return ( | ||
<div className="flex text-sm p-4 bg-blue-100 whitespace-pre-wrap items-center font-mono"> | ||
{text} | ||
<div className="ml-2 cursor-pointer"> | ||
{isCopied ? ( | ||
<MdOutlineCheckCircle className="text-green-700" size="24" /> | ||
) : ( | ||
<MdOutlineContentCopy onClick={handleCopyClick} size="24" /> | ||
)} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import Markdown from 'markdown-to-jsx' | ||
import Link, { type LinkProps } from 'next/link' | ||
import type { ReactNode } from 'react' | ||
import { MdKeyboardArrowRight } from 'react-icons/md' | ||
import { useIntl } from 'react-intl' | ||
import { formatMediumDate } from 'utils' | ||
import type { icons } from 'utils/icons' | ||
import ArchivedTag from './ArchivedTag' | ||
import DescriptorIcon from './DescriptorIcon' | ||
|
||
type Span = { | ||
children: React.ReactNode | ||
} | ||
const Span = ({ children }: Span) => <span>{children}</span> | ||
|
||
type StyledLink = LinkProps & { children: ReactNode } | ||
|
||
const StyledLink = ({ href, ...props }: StyledLink) => ( | ||
<Link | ||
href={href} | ||
{...props} | ||
className="flex justify-between text-black leading-[1.3] bg-white p-4 border border-gray-300 rounded-lg cursor-pointer relative hover:text-blue-500" | ||
/> | ||
) | ||
|
||
type DescriptorCard = { | ||
descriptor: Descriptor | ||
} | ||
|
||
const DescriptorCard = ({ descriptor }: DescriptorCard) => { | ||
const { locale, formatMessage } = useIntl() | ||
|
||
return ( | ||
<StyledLink href={`/v2/${descriptor.oonirun_link_id}`}> | ||
<div className="self-start"> | ||
<div className="mb-1"> | ||
<h4 className="m-0 inline mr-2"> | ||
{descriptor?.icon && ( | ||
<DescriptorIcon icon={descriptor.icon as keyof typeof icons} /> | ||
)} | ||
{descriptor.name} | ||
</h4> | ||
{!!descriptor.is_expired && ( | ||
<span className="align-text-bottom"> | ||
<ArchivedTag /> | ||
</span> | ||
)} | ||
</div> | ||
<div className="mb-2"> | ||
{descriptor.author && ( | ||
<span> | ||
{formatMessage( | ||
{ id: 'DescriptorCard.CreatedBy' }, | ||
{ | ||
author: ( | ||
<span className="font-bold">{descriptor.author}</span> | ||
), | ||
}, | ||
)}{' '} | ||
|{' '} | ||
</span> | ||
)}{' '} | ||
{formatMessage( | ||
{ id: 'DescriptorCard.Updated' }, | ||
{ date: formatMediumDate(descriptor.date_updated, locale) }, | ||
)}{' '} | ||
|{' '} | ||
{descriptor.is_expired | ||
? formatMessage( | ||
{ id: 'DescriptorCard.Expired' }, | ||
{ date: formatMediumDate(descriptor.expiration_date, locale) }, | ||
) | ||
: formatMessage( | ||
{ id: 'DescriptorCard.Expiring' }, | ||
{ date: formatMediumDate(descriptor.expiration_date, locale) }, | ||
)} | ||
</div> | ||
{descriptor.short_description && ( | ||
<div className="text-gray-500"> | ||
<Markdown | ||
options={{ | ||
overrides: { | ||
a: { | ||
component: Span, | ||
}, | ||
}, | ||
}} | ||
> | ||
{descriptor.short_description} | ||
</Markdown> | ||
</div> | ||
)} | ||
</div> | ||
<div className="self-center"> | ||
<MdKeyboardArrowRight /> | ||
</div> | ||
</StyledLink> | ||
) | ||
} | ||
|
||
export default DescriptorCard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { icons } from 'utils/icons' | ||
|
||
type DescriptorIconProps = { | ||
icon: keyof typeof icons | ||
} | ||
|
||
const DescriptorIcon = ({ icon }: DescriptorIconProps) => { | ||
if (!icon) return '' | ||
|
||
const IconComponent = icons[icon] | ||
|
||
return IconComponent ? ( | ||
<IconComponent style={{ marginRight: '10px' }} className="inline" /> | ||
) : ( | ||
'' | ||
) | ||
} | ||
|
||
export default DescriptorIcon |
Oops, something went wrong.