1
0
mirror of https://github.com/uetchy/namae.git synced 2025-07-02 14:20:03 +09:00

fix: api folder name, message and normalize rules

This commit is contained in:
Arnaud Lier 2022-03-09 19:33:12 +01:00 committed by GitHub
parent 629a5351b3
commit 9bc32ffd16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -8,14 +8,14 @@ import { Card, Repeater, DedicatedAvailability } from '../core';
const SubredditCard: React.FC<{ query: string }> = ({ query }) => { const SubredditCard: React.FC<{ query: string }> = ({ query }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const normalizedQuery = normalize(query, { const normalizedQuery = normalize(query, {
allowUnderscore: false, allowUnderscore: true,
}); });
const lowerCase = normalizedQuery.toLowerCase(); const lowerCase = normalizedQuery.toLowerCase();
const names = [normalizedQuery]; const names = [normalizedQuery];
const moreNames = [ const moreNames = [
`get${lowerCase}`, `get${lowerCase}`,
`${lowerCase}-team`, `${lowerCase}_team`,
]; ];
return ( return (
@ -25,6 +25,7 @@ const SubredditCard: React.FC<{ query: string }> = ({ query }) => {
<DedicatedAvailability <DedicatedAvailability
name={name} name={name}
service="reddit" // route to http://namae.dev/api/services/reddit/<query> which is /api/services/reddit/[query].ts on GitHub service="reddit" // route to http://namae.dev/api/services/reddit/<query> which is /api/services/reddit/[query].ts on GitHub
message={`Go to reddit.com/r/${name}`}
link={`https://reddit.com/r/${name}`} link={`https://reddit.com/r/${name}`}
prefix="reddit.com/r/" prefix="reddit.com/r/"
icon={<FaReddit />} icon={<FaReddit />}