Skip to content

Commit

Permalink
[Refactor] Use Typescript (Step 2: Add new files)
Browse files Browse the repository at this point in the history
  • Loading branch information
CornWorld committed Dec 27, 2024
1 parent 78bf6ee commit 9a2f7c3
Show file tree
Hide file tree
Showing 44 changed files with 3,360 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# idea
.idea
28 changes: 28 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
36 changes: 36 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!--
___ ___ ________ ________ _________ _______ ________ _____ ______
|\ \|\ \|\ __ \|\ ___ \ |\___ ___\\ ___ \ |\ __ \|\ _ \ _ \
\ \ \\\ \ \ \|\ \ \ \_|\ \ \|___ \ \_\ \ __/|\ \ \|\ \ \ \\\__\ \ \
\ \ __ \ \ __ \ \ \ \\ \ \ \ \ \ \ \_|/_\ \ __ \ \ \\|__| \ \
\ \ \ \ \ \ \ \ \ \ \_\\ \ \ \ \ \ \ \_|\ \ \ \ \ \ \ \ \ \ \
\ \__\ \__\ \__\ \__\ \_______\ \ \__\ \ \_______\ \__\ \__\ \__\ \ \__\
\|__|\|__|\|__|\|__|\|_______| \|__| \|_______|\|__|\|__|\|__| \|__|
Github: https://github.com/HadTeam
-->

<html lang="zh">
<head>
<title>cdMir</title>
<meta charset="UTF-8" content="text/html">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="Software,Mirror,software,mirror,download,Download,下载,软件,镜像,列表" name="Keywords"/>
<meta content="A high-speed download mirror list of common software for Chinese users." name="Description"/>
<meta content="width=device-width, initial-scale=0.9, maximum-scale=1.0, user-scalable=no" name="viewport"/>
<meta content="pc,mobile" name="applicable-device">
<meta content="CornWorld" name="Author"/>
<meta content="CornWorld" name="Designer"/>
<meta content="Index" name="Robots"/>
</head>
<body>

<div id="root" style="padding: 59px 0 10px 0">

</div>

<script type="module" src="/src/main.tsx"></script>

</body>
</html>
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "cdmir-ts",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"@fontsource/jetbrains-mono": "^5.1.1",
"@types/lodash": "^4.17.13",
"@types/node": "^22.10.2",
"events": "^3.3.0",
"fomantic-ui-css": "^2.9.3",
"lodash": "^4.17.21",
"react": "^18.3.1",
"react-device-detect": "^2.2.3",
"react-dom": "^18.3.1",
"react-router-dom": "^7.1.1",
"semantic-ui-react": "^2.1.5",
"web-vitals": "^4.2.4"
},
"devDependencies": {
"@eslint/js": "^9.17.0",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.17.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.16",
"globals": "^15.14.0",
"typescript": "~5.6.2",
"typescript-eslint": "^8.18.2",
"vite": "^6.0.5"
}
}
5 changes: 5 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# robots.txt
User-agent: *
Disallow:
Disallow: /files
Disallow: /about
Binary file added public/static/avatar/cornworld.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static/avatar/dhclientqwq.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static/avatar/echidna.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static/image/alipay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static/image/qqpay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/static/image/wechatpay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 88 additions & 0 deletions src/About.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { FC } from 'react';

Check failure on line 1 in src/About.tsx

View workflow job for this annotation

GitHub Actions / deploy to Tencent COS

Could not find a declaration file for module 'react'. '/home/runner/work/cdMir/cdMir/node_modules/react/index.js' implicitly has an 'any' type.

Check failure on line 1 in src/About.tsx

View workflow job for this annotation

GitHub Actions / deploy to Tencent COS

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

Check failure on line 1 in src/About.tsx

View workflow job for this annotation

GitHub Actions / deploy to Tencent COS

Could not find a declaration file for module 'react/jsx-runtime'. '/home/runner/work/cdMir/cdMir/node_modules/react/jsx-runtime.js' implicitly has an 'any' type.

Check failure on line 1 in src/About.tsx

View workflow job for this annotation

GitHub Actions / deploy to Tencent COS

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

Check failure on line 1 in src/About.tsx

View workflow job for this annotation

GitHub Actions / deploy to Tencent COS

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

Check failure on line 1 in src/About.tsx

View workflow job for this annotation

GitHub Actions / deploy to Tencent COS

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

Check failure on line 1 in src/About.tsx

View workflow job for this annotation

GitHub Actions / deploy to Tencent COS

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

Check failure on line 1 in src/About.tsx

View workflow job for this annotation

GitHub Actions / deploy to Tencent COS

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

Check failure on line 1 in src/About.tsx

View workflow job for this annotation

GitHub Actions / deploy to Tencent COS

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

Check failure on line 1 in src/About.tsx

View workflow job for this annotation

GitHub Actions / deploy to Tencent COS

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
import { Accordion, Card, Container, Divider, Icon } from 'semantic-ui-react';
import { isMobile } from 'react-device-detect';

import contributors from './data/processed/contributors.json';
import faqs from './data/processed/faqs.json';
import donateInfo from './data/processed/donateInfo.json';

interface Contributor {
header: string;
href: string;
as: string;
image: string;
meta: string;
description: string;
}

interface FAQ {
key: string;
title: string;
content: string;
}

interface DonateInfo {
image: string;
header: string;
meta: string;
}

const About: FC = () => {
return (
<div id='body'>
<Container>
<Divider horizontal as='h4' id='contributor'>
<Icon name='thumbs up outline'/>
贡献者
</Divider>
<Divider hidden/>
<Container>
<Card.Group
centered
itemsPerRow={isMobile ? 2 : 4}
items={contributors as Contributor[]}
/>
</Container>

<Divider horizontal as='h4' id='description'>
<Icon name='tag'/>
介绍
</Divider>
<Divider hidden/>
<Container>
<p>这是一个软件镜像站,旨在通过搜集或搭建镜像的方式,为处于中国大陆的用户提供高速下载服务。</p>
<p>如果您需要软件并未被 cdMir 收录,请联系我们(包括但不限于 发布Issues、社交媒体联系、邮箱联系),我们会考虑并添加。</p>
<p>如果您认为我们值得支持,请 star 我们的<a href='https://github.com/HadTeam/cdMir'>仓库</a></p>
<p><a href='https://github.com/HadTeam/cdMir/blob/main/README.md'>[更多介绍可参见 README.md 文件]</a></p>
</Container>

<Divider horizontal as='h4' id='faq'>
<Icon name='question'/>
FAQ
</Divider>
<Divider hidden/>
<Container>
<Accordion
exclusive={false}
fluid
panels={faqs as FAQ[]}
/>
</Container>

<Divider horizontal as='h4' id='donate'>
<Icon name='yen sign'/>
捐助
</Divider>
<Container>
<Card.Group
itemsPerRow={isMobile ? 3 : 5}
centered
items={donateInfo as DonateInfo[]}
/>
</Container>
</Container>
</div>
);
};

export default About;
Loading

0 comments on commit 9a2f7c3

Please sign in to comment.