generated from idea2app/Next-Bootstrap-ts
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[add] OS License Filter & Project links
- Loading branch information
Showing
11 changed files
with
548 additions
and
42 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,66 @@ | ||
import { FeatureAttitude, InfectionRange } from 'license-filter'; | ||
|
||
import { i18n } from '../../models/Translation'; | ||
|
||
const { t } = i18n; | ||
|
||
type OptionValue = Record<string, { value: number; text: string }[]>; | ||
|
||
type LicenseTips = Record<string, { text: string }[]>; | ||
|
||
const options: string[] = [ | ||
'popularity', | ||
'reuseCondition', | ||
'infectionIntensity', | ||
'jurisdiction', | ||
'patentStatement', | ||
'patentRetaliation', | ||
'enhancedAttribution', | ||
'privacyLoophole', | ||
'marketingEndorsement', | ||
]; | ||
|
||
export const optionValue = () => { | ||
const optionValue = options.reduce((optionValue, option) => { | ||
optionValue[option] = [ | ||
{ | ||
value: FeatureAttitude.Undefined, | ||
text: t('feature_attitude_undefined'), | ||
}, | ||
{ | ||
value: FeatureAttitude.Positive, | ||
text: t('feature_attitude_positive'), | ||
}, | ||
{ | ||
value: FeatureAttitude.Negative, | ||
text: t('feature_attitude_negative'), | ||
}, | ||
]; | ||
return optionValue; | ||
}, {} as OptionValue); | ||
|
||
optionValue.infectionRange = [ | ||
{ value: 0, text: t('infection_range_undefined') }, | ||
{ value: InfectionRange.Library, text: t('infection_range_library') }, | ||
{ value: InfectionRange.File, text: t('infection_range_file') }, | ||
{ value: InfectionRange.Module, text: t('infection_range_module') }, | ||
]; | ||
|
||
return optionValue; | ||
}; | ||
|
||
export const licenseTips: () => LicenseTips = () => ({ | ||
popularity: [ | ||
{ text: t('tip_popularity_0') }, | ||
{ text: t('tip_popularity_1') }, | ||
], | ||
reuseCondition: [{ text: t('tip_reuse_condition') }], | ||
infectionIntensity: [{ text: t('tip_infection_intensity') }], | ||
jurisdiction: [{ text: t('tip_jurisdiction') }], | ||
patentStatement: [{ text: t('tip_patent_statement') }], | ||
patentRetaliation: [{ text: t('tip_patent_retaliation') }], | ||
enhancedAttribution: [{ text: t('tip_enhanced_attribution') }], | ||
privacyLoophole: [{ text: t('tip_privacy_loophole') }], | ||
marketingEndorsement: [{ text: t('tip_marketing_endorsement') }], | ||
infectionRange: [{ text: t('tip_infection_range') }], | ||
}); |
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 |
---|---|---|
@@ -1,28 +1,29 @@ | ||
import { observer } from 'mobx-react'; | ||
import Head from 'next/head'; | ||
import type { FC, PropsWithChildren } from 'react'; | ||
|
||
import { i18n } from '../models/Translation'; | ||
|
||
export type PageHeadProps = PropsWithChildren<{ | ||
title?: string; | ||
description?: string; | ||
}>; | ||
|
||
const Name = process.env.NEXT_PUBLIC_SITE_NAME, | ||
const { t } = i18n, | ||
Summary = process.env.NEXT_PUBLIC_SITE_SUMMARY; | ||
|
||
export const PageHead: FC<PageHeadProps> = ({ | ||
title, | ||
description = Summary, | ||
children, | ||
}) => ( | ||
<Head> | ||
<title> | ||
{title} | ||
{title && ' - '} | ||
{Name} | ||
</title> | ||
export const PageHead: FC<PageHeadProps> = observer( | ||
({ title, description = Summary, children }) => ( | ||
<Head> | ||
<title> | ||
{title} | ||
{title && ' - '} | ||
{t('open_source_treasure_box')} | ||
</title> | ||
|
||
{description && <meta name="description" content={description} />} | ||
{description && <meta name="description" content={description} />} | ||
|
||
{children} | ||
</Head> | ||
{children} | ||
</Head> | ||
), | ||
); |
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 @@ | ||
import { i18n } from '../models/Translation'; | ||
|
||
const { t } = i18n; | ||
|
||
export interface Link { | ||
title: string; | ||
path?: string; | ||
subs?: Link[]; | ||
} | ||
|
||
export const MainRoutes: () => Link[] = () => [ | ||
{ title: t('license_tool'), path: '/tool/license-filter' }, | ||
{ | ||
title: `${t('Web_polyfill_CDN')} v1`, | ||
path: 'https://polyfill.kaiyuanshe.cn/', | ||
}, | ||
{ | ||
title: `${t('Web_polyfill_CDN')} v2`, | ||
path: 'https://polyfiller.kaiyuanshe.cn/', | ||
}, | ||
{ title: t('open_source_mirror'), path: 'http://mirror.kaiyuanshe.cn/' }, | ||
{ title: 'Git Pager', path: 'https://git-pager.vercel.app/' }, | ||
{ | ||
title: t('source_code'), | ||
path: 'https://github.com/kaiyuanshe/OSS-toolbox', | ||
}, | ||
]; |
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
Oops, something went wrong.