Skip to content
Merged
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
40 changes: 31 additions & 9 deletions components/Package/MorePackagesBox.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { LI, UL } from '@expo/html-elements';
import { startCase } from 'es-toolkit';
import { type NextPageContext } from 'next';
import * as emoji from 'node-emoji';
import { useMemo } from 'react';
import { View } from 'react-native';
import useSWR from 'swr';

import { A, Caption, H6, Label, useLayout } from '~/common/styleguide';
import { Download, Star } from '~/components/Icons';
import { Download, Star, Warning } from '~/components/Icons';
import Tooltip from '~/components/Tooltip';
import { type APIResponseType, type LibraryType } from '~/types';
import { TimeRange } from '~/util/datetime';
import getApiUrl from '~/util/getApiUrl';
Expand Down Expand Up @@ -60,7 +62,7 @@ export default function MorePackagesBox({ library }: Props) {
<EntityCounter count={data.total > LIMIT ? data.total : data.total - 1} />
) : null}
{!isSmallScreen && data?.total && data.total > LIMIT && (
<A href={`/?owner=${encodeURI(owner)}`} style={tw`ml-auto`}>
<A href={`/packages?owner=${encodeURI(owner)}`} style={tw`ml-auto`}>
<Caption style={tw`font-light`}>See all packages</Caption>
</A>
)}
Expand All @@ -73,7 +75,7 @@ export default function MorePackagesBox({ library }: Props) {
{data.libraries
.filter(({ npmPkg }) => npmPkg !== library.npmPkg)
.slice(0, LIMIT - 1)
.map(({ npmPkg, npm, github }) => (
.map(({ npmPkg, npm, github, unmaintained }) => (
<LI key={npmPkg}>
<A
href={`/package/${npmPkg}`}
Expand All @@ -84,13 +86,33 @@ export default function MorePackagesBox({ library }: Props) {
hoverStyle={tw`bg-palette-gray1 dark:bg-dark`}>
<View
style={[
tw`flex w-full max-w-full flex-row items-center gap-2.5`,
tw`flex w-full max-w-full flex-row items-center gap-2`,
isSmallScreen && tw`flex-col items-start gap-1`,
]}>
<Caption style={tw`flex-shrink-0 text-sm`}>{npmPkg}</Caption>
<Label numberOfLines={1} style={tw`font-light text-secondary`}>
{github.description}
</Label>
<Caption style={tw`flex flex-shrink-0 items-center gap-1.5 text-sm`}>
{unmaintained && (
<Tooltip
trigger={
<View>
<Warning style={tw`text-warning-dark dark:text-warning`} />
</View>
}>
Unmaintained
</Tooltip>
)}
{npmPkg}
</Caption>
{github.description ? (
<Label numberOfLines={1} style={tw`font-light text-secondary`}>
{emoji.emojify(github.description)}
</Label>
) : (
<Label
numberOfLines={1}
style={tw`font-light text-tertiary dark:text-palette-gray5`}>
The package does not have a description defined.
</Label>
)}
<View
style={[
tw`ml-auto flex-row gap-4 text-sm font-light leading-[14px] text-icon`,
Expand All @@ -111,7 +133,7 @@ export default function MorePackagesBox({ library }: Props) {
))}
</UL>
{isSmallScreen && data.total > LIMIT && (
<A href={`/?owner=${encodeURI(owner)}`} style={tw`text-center`}>
<A href={`/packages?owner=${encodeURI(owner)}`} style={tw`text-center`}>
<Caption style={tw`font-light`}>See all packages</Caption>
</A>
)}
Expand Down
2 changes: 1 addition & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function DirectoryWebsite() {
'@type': 'SearchAction',
target: {
'@type': 'EntryPoint',
urlTemplate: 'https://reactnative.directory/?search={search_term_string}',
urlTemplate: 'https://reactnative.directory/packages?search={search_term_string}',
},
'query-input': 'required name=search_term_string',
},
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"protocol_handlers": [
{
"protocol": "web+rnd",
"url": "/?search=%s"
"url": "/packages?search=%s"
}
],
"theme_color": "#20232a",
Expand Down
5 changes: 4 additions & 1 deletion scenes/PackageOverviewScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ export default function PackageOverviewScene({
</H6>
<View style={tw`flex-row flex-wrap items-start gap-x-2 gap-y-0.5`}>
{library.github.topics.map(topic => (
<A key={topic} href={`/?search=${topic}`} style={tw`text-[12px] font-light`}>
<A
key={topic}
href={`/packages?search=${topic}`}
style={tw`text-[12px] font-light`}>
{topic}
</A>
))}
Expand Down