Skip to content

Commit

Permalink
Merge pull request #27 from typescript-tutorial-exercises/dev
Browse files Browse the repository at this point in the history
release-20231105
  • Loading branch information
ZLY201 authored Nov 4, 2023
2 parents b0c2ca1 + 3206cb2 commit d498430
Show file tree
Hide file tree
Showing 18 changed files with 380 additions and 74 deletions.
73 changes: 73 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Typescript-Tutorial-Exercises Contributing Guide

Hi! I'm really excited that you are interested in contributing to js-sdsl. Before submitting your contribution, please make sure to take a moment and read through the following guidelines:

- [Code of Conduct](https://github.com/typescript-tutorial-exercises/core/blob/main/CODE_OF_CONDUCT.md)
- [Issue Reporting Guidelines](#issue-reporting-guidelines)
- [Pull Request Guidelines](#pull-request-guidelines)
- [Development Setup](#development-setup)
- [Project Structure](#project-structure)

## Issue Reporting Guidelines

- Always use issue-template to create new issues.

## Pull Request Guidelines

- The `main` branch is just a snapshot of the latest stable release. All development should be done in dedicated branches. **Do not submit PRs against the `main` branch.**

- Checkout a topic branch from the relevant branch, e.g. `dev`, and merge back against that branch.

- Work in the `src` folder and **DO NOT** check in `dist` in the commits.

- It's OK to have multiple small commits as you work on the PR - GitHub will automatically squash it before merging.

- Make sure it works fine in local environment. (see [development setup](#development-setup))

- If adding a new feature:
- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first and have it approved before working on it.

- If fixing bug:
- If you are resolving a special issue, add `(fix #xxxx[,#xxxx])` (#xxxx is the issue id) in your PR title for a better release log, e.g. `update entities encoding/decoding (fix #3899)`.
- Provide a detailed description of the bug in the PR. Live demo preferred.
- Add appropriate test coverage if applicable.

## Development Setup

You will need [Node.js](http://nodejs.org) **version 16+** and [yarn](https://yarnpkg.com/).

After cloning the repo, run:

```bash
$ yarn setup
```

### Committing Changes

Please follow the commit specification. See [`.commitlintrc.json`](https://github.com/typescript-tutorial-exercises/core/blob/main/.commitlintrc.json) get help.

### Commonly used NPM scripts

```bash
# run project in development mode
$ yarn dev
# build all dist files
$ yarn build
```

There are some other scripts available in the `scripts` section of the `package.json` file.

## Project Structure

- **`assets`**: contains static files of the site
- **`config`**: contains configuration files
- **`src`**: contains the source code
- **`problems`**: contains all the problems

All our source files are written in typescript, please make sure your submissions have strict type deduction and follow eslint specifications.

## Credits

Thank you to all the people who have already contributed to `typescript-tutorial-exercises`!

[![contributors](https://contrib.rocks/image?repo=typescript-tutorial-exercises/core)](https://github.com/typescript-tutorial-exercises/core/graphs/contributors)
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

open_collective: typescript-tutorial-exercises
custom: ["https://www.paypal.com/paypalme/zly201"]
4 changes: 4 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
schedule:
- cron: '28 17 * * 5'

concurrency:
group: CodeQL-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
- dev
- main

concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy:
runs-on: ubuntu-latest
Expand Down
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
## Typescript Tutorial Exercise
# Typescript Tutorial Exercise

Reference https://github.com/typescript-exercises/typescript-exercises.
[![status](https://img.shields.io/github/actions/workflow/status/typescript-tutorial-exercises/core/deploy.yml)](https://github.com/typescript-tutorial-exercises/core/actions/workflows/deploy.yml)
[![stars](https://img.shields.io/github/stars/typescript-tutorial-exercises/core.svg)](https://github.com/typescript-tutorial-exercises/core)
[![licenses](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![language](https://img.shields.io/github/languages/top/typescript-tutorial-exercises/core.svg)](https://github.com/typescript-tutorial-exercises/core)

Demo address: https://zly201.github.io/typescript-tutorial-exercises
## Getting Started

[MIT license](./LICENSE)
Please go to [typescript-tutorial-exercises.github.io](https://typescript-tutorial-exercises.github.io/) to start your TypeScript travel!

## Contribution

Feel free to dive in! Open an issue or submit PRs. It may be helpful to read the [Contributor Guide](./.github/CONTRIBUTING.md).

### Contributors

Thanks goes to these wonderful people:

[![contributors](https://contrib.rocks/image?repo=typescript-tutorial-exercises/core)](https://github.com/typescript-tutorial-exercises/core/graphs/contributors)


## License

This project is free and open-source software licensed under the [MIT License](./LICENSE).

This project partially copies code from the following projects, their licenses are listed in [Third-party library licenses](./THIRD-PARTY-LICENSE).

| Project | License |
| ------------- | ------------- |
| [typescript-exercises/typescript-exercises](https://github.com/typescript-exercises/typescript-exercises) | [MIT](https://github.com/typescript-exercises/typescript-exercises/blob/main/LICENSE) |
23 changes: 23 additions & 0 deletions THIRD-PARTY-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
typescript-exercises/typescript-exercises

MIT License

Copyright (c) 2021 Dulin Marat

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
20 changes: 20 additions & 0 deletions config/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,25 @@
"request_error": {
"en": "Network error, please check your network or refresh the page",
"zhCN": "网络请求失败,请检查网络状况后刷新重试"
},
"confirm_title": {
"en": "Confirm",
"zhCN": "确认"
},
"confirm_btn": {
"en": "confirm",
"zhCN": "确认"
},
"cancel_btn": {
"en": "cancel",
"zhCN": "取消"
},
"confirm_reset_code": {
"en": "Are you sure to reset code?",
"zhCN": "确认重置代码?"
},
"confirm_reset_cases": {
"en": "Are you sure to reset cases?",
"zhCN": "确认重置示例?"
}
}
3 changes: 2 additions & 1 deletion config/links.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"github": "https://github.com/zly201"
"github-repo": "https://github.com/typescript-tutorial-exercises/core",
"github-zly201": "https://github.com/zly201"
}
11 changes: 11 additions & 0 deletions rspack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ export default function createRspackConfig(): Configuration {
},
{
loader: 'css-loader',
options: {
modules: {
mode: 'local',
auto: true,
exportGlobals: true,
localIdentName: '[path][name]__[local]--[hash:base64:5]',
localIdentContext: path.resolve(__dirname, 'src'),
exportLocalsConvention: 'camelCase',
exportOnlyLocals: false,
},
},
},
{
loader: 'less-loader',
Expand Down
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import settingList from '@src/utils/setting';
import Question from '@src/modules/Question';
import localCache from '@src/utils/local-cache';
import Results from '@src/modules/Results';
import { setCurrentProblemForUrl } from '@src/utils/url';
import styles from './index.module.less';
import './global.less';

Expand Down Expand Up @@ -40,6 +41,7 @@ function App() {
context.currentProblem !== update.currentProblem
) {
updateCache(update.currentProblem.key);
setCurrentProblemForUrl(update.currentProblem.key);
}
setContext({
...context,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Markdown/index.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ blockquote {
margin-bottom: 4px;
}
}
code {
p > code {
margin: 0 2px;
padding: 2px 4px;
vertical-align: middle;
Expand Down
14 changes: 8 additions & 6 deletions src/modules/Editor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Modal, Skeleton } from '@arco-design/web-react';
import { Modal, Skeleton, Tooltip } from '@arco-design/web-react';
import { IconCode, IconUndo } from '@arco-design/web-react/icon';
import debounce from 'lodash.debounce';
import { useCallback, useContext, useEffect, useState } from 'react';
Expand Down Expand Up @@ -44,10 +44,10 @@ function Editor() {

function resetCode() {
const modal = Modal.confirm({
title: 'Confirm',
content: 'Are you sure to reset code?',
okText: 'confirm',
cancelText: 'cancel',
title: i18nJson['confirm_title'][setting.language],
content: i18nJson['confirm_reset_code'][setting.language],
okText: i18nJson['confirm_btn'][setting.language],
cancelText: i18nJson['cancel_btn'][setting.language],
onOk: async function () {
setLoading(true);
localCache.setProblemCache(currentProblem.key, {
Expand Down Expand Up @@ -75,7 +75,9 @@ function Editor() {
{i18nJson['code'][setting.language]}
</span>
<a onClick={resetCode} className={styles.reset}>
<IconUndo />
<Tooltip mini={true} content={'reset'}>
<IconUndo />
</Tooltip>
</a>
</div>
<Skeleton
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styles from './index.module.less';
const Footer = function () {
return (
<div className={styles.container}>
<a href={linkJson.github} target={'_blank'} rel="noreferrer">
<a href={linkJson['github-zly201']} target={'_blank'} rel="noreferrer">
copyright © 2023-Present ZLY201
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Header = function () {
<a
style={{ color: 'inherit' }}
className={styles.icon}
href={linkJson.github}
href={linkJson['github-repo']}
target={'_blank'}
rel="noreferrer"
>
Expand Down
5 changes: 4 additions & 1 deletion src/modules/Question/Description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ const Description = function () {
const {
key,
title,
contributor: { name, link } = { name: 'ZLY201', link: linkJson.github },
contributor: { name, link } = {
name: 'ZLY201',
link: linkJson['github-zly201'],
},
cases = [NULL_CASE],
} = currentProblem;
const [desc, setDesc] = useState('');
Expand Down
Loading

0 comments on commit d498430

Please sign in to comment.