-
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.
- Loading branch information
Loo
authored and
Loo
committed
Oct 15, 2023
1 parent
a681e10
commit 79b6677
Showing
5 changed files
with
153 additions
and
80 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
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react' | ||
import _ from 'lodash' | ||
import { createRoot } from 'react-dom/client' | ||
import { createPortal } from 'react-dom' | ||
import { UserType } from './interface' | ||
|
||
interface IShowUserListRProps { | ||
userList: UserType[] | ||
} | ||
export const ShowUserListR: React.FC<IShowUserListRProps> = ({ userList }) => { | ||
if (_.isEmpty(userList)) return | ||
|
||
return ( | ||
<div> | ||
{_.map(userList, userInfo => { | ||
const { uid, avatar, title } = userInfo || {} | ||
const hrefUrl = /\d+/.test(uid) ? '//weibo.com/u/' + uid : '//weibo.com/' + uid | ||
return ( | ||
<div> | ||
<img src={avatar} alt={title} /> | ||
<a href={hrefUrl} target="_blank"> | ||
<span>{title}</span> | ||
</a> | ||
</div> | ||
) | ||
})} | ||
</div> | ||
) | ||
} | ||
|
||
export const XShowUserListR = ({ userList }: IShowUserListRProps) => { | ||
if (!userList) { | ||
return | ||
} | ||
// const root = createRoot(document.body) | ||
// root.render(<ShowUserListR userList={userList} />) | ||
const container = document.createElement('div') | ||
document.body.appendChild(container) | ||
|
||
createPortal(<ShowUserListR userList={userList} />, container) | ||
|
||
// return result; | ||
} |
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,76 +1,78 @@ | ||
{ | ||
"name": "weibo-extend", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"clear:terminal": "tput reset", | ||
"afterbuild": "node ./buildAfter.js", | ||
"zip:extension": "rm -rf weibo-extend.zip && cd ./extension && zip -r ../weibo-extend.zip . && cd ..", | ||
"pack:extensionscript": "webpack --config ./extension.webpack.config.js", | ||
"bun:pack": "bun ./bunpack.ts", | ||
"build:extension": "npm run clear:terminal && npm run pack:extensionscript && cross-env-shell BUILD_TYPE=extension npm run build && npm run afterbuild && npm run zip:extension", | ||
"bun:extension": "bun clear:terminal && bun bun:pack && cross-env-shell BUILD_TYPE=extension bun run build && bun afterbuild && bun zip:extension", | ||
"eslint": "./node_modules/.bin/eslint \"app/**/*.{js,jsx,ts,tsx}\" --ignore-pattern \"app/lib/\" --ignore-pattern \"app/shared/\"", | ||
"check-types": "tsc --noemit", | ||
"eslint:commit": "git diff --cached --name-only | grep -E 'app.*\\.[jt]sx?$' | xargs ./node_modules/.bin/eslint --quiet", | ||
"eslint:quiet": "./node_modules/.bin/eslint \"app/**/*.{js,jsx,ts,tsx}\" --ignore-pattern \"app/lib/\" --ignore-pattern \"app/shared/\" --quiet", | ||
"prettier:single": "./node_modules/.bin/prettier --single-quote --no-semi --trailing-comma es5 --print-width 120 --tab-width 4 --arrow-parens avoid --write", | ||
"prettier": "./node_modules/.bin/prettier --single-quote --no-semi --trailing-comma es5 --print-width 120 --tab-width 4 --arrow-parens avoid --write \"app/**/*.{js,jsx,ts,tsx}\"", | ||
"prettier:check": "npm run prettier -- --list-different", | ||
"lint-staged": "lint-staged" | ||
}, | ||
"keywords": [ | ||
"chrome", | ||
"extension", | ||
"nextjs", | ||
"weibo" | ||
], | ||
"author": "loo-y", | ||
"license": "ISC", | ||
"pre-commit": "lint-staged", | ||
"lint-staged": { | ||
"app/**/*.{js,jsx,ts,tsx}": [ | ||
"npm run eslint:commit", | ||
"prettier --single-quote --no-semi --trailing-comma es5 --print-width 120 --tab-width 4 --arrow-parens avoid --write \"!app/lib/**\"", | ||
"git add" | ||
] | ||
}, | ||
"dependencies": { | ||
"jquery": "^3.7.1", | ||
"js-cookie": "^3.0.5", | ||
"lodash": "^4.17.21", | ||
"next": "13.5.4", | ||
"react": "^18", | ||
"react-dom": "^18" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.23.0", | ||
"@babel/core": "^7.23.0", | ||
"@babel/preset-env": "^7.22.20", | ||
"@babel/preset-typescript": "^7.23.0", | ||
"@types/lodash": "^4.14.199", | ||
"@types/node": "^20", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"autoprefixer": "^10", | ||
"babel-plugin-transform-remove-console": "^6.9.4", | ||
"cheerio": "^1.0.0-rc.12", | ||
"clean-webpack-plugin": "^4.0.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8", | ||
"eslint-config-next": "13.5.4", | ||
"lint-staged": "^14.0.1", | ||
"postcss": "^8", | ||
"pre-commit": "^1.2.2", | ||
"prettier": "^3.0.3", | ||
"tailwindcss": "^3", | ||
"ts-loader": "^9.5.0", | ||
"typescript": "^5.2.2", | ||
"webpack": "^5.88.2", | ||
"webpack-cli": "^5.1.4" | ||
} | ||
"name": "weibo-extend", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"clear:terminal": "tput reset", | ||
"afterbuild": "node ./buildAfter.js", | ||
"zip:extension": "rm -rf weibo-extend.zip && cd ./extension && zip -r ../weibo-extend.zip . && cd ..", | ||
"pack:extensionscript": "webpack --config ./extension.webpack.config.js", | ||
"bun:pack": "bun ./bunpack.ts", | ||
"build:extension": "npm run clear:terminal && npm run pack:extensionscript && cross-env-shell BUILD_TYPE=extension npm run build && npm run afterbuild && npm run zip:extension", | ||
"bun:extension": "bun clear:terminal && bun bun:pack && cross-env-shell BUILD_TYPE=extension bun run build && bun afterbuild && bun zip:extension", | ||
"eslint": "./node_modules/.bin/eslint \"app/**/*.{js,jsx,ts,tsx}\" --ignore-pattern \"app/lib/\" --ignore-pattern \"app/shared/\"", | ||
"check-types": "tsc --noemit", | ||
"eslint:commit": "git diff --cached --name-only | grep -E 'app.*\\.[jt]sx?$' | xargs ./node_modules/.bin/eslint --quiet", | ||
"eslint:quiet": "./node_modules/.bin/eslint \"app/**/*.{js,jsx,ts,tsx}\" --ignore-pattern \"app/lib/\" --ignore-pattern \"app/shared/\" --quiet", | ||
"prettier:single": "./node_modules/.bin/prettier --single-quote --no-semi --trailing-comma es5 --print-width 120 --tab-width 4 --arrow-parens avoid --write", | ||
"prettier": "./node_modules/.bin/prettier --single-quote --no-semi --trailing-comma es5 --print-width 120 --tab-width 4 --arrow-parens avoid --write \"app/**/*.{js,jsx,ts,tsx}\"", | ||
"prettier:check": "npm run prettier -- --list-different", | ||
"lint-staged": "lint-staged" | ||
}, | ||
"keywords": [ | ||
"chrome", | ||
"extension", | ||
"nextjs", | ||
"weibo" | ||
], | ||
"author": "loo-y", | ||
"license": "ISC", | ||
"pre-commit": "lint-staged", | ||
"lint-staged": { | ||
"app/**/*.{js,jsx,ts,tsx}": [ | ||
"npm run eslint:commit", | ||
"prettier --single-quote --no-semi --trailing-comma es5 --print-width 120 --tab-width 4 --arrow-parens avoid --write \"!app/lib/**\"", | ||
"git add" | ||
] | ||
}, | ||
"dependencies": { | ||
"jquery": "^3.7.1", | ||
"js-cookie": "^3.0.5", | ||
"lodash": "^4.17.21", | ||
"next": "13.5.4", | ||
"react": "^18", | ||
"react-dom": "^18" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.23.0", | ||
"@babel/core": "^7.23.2", | ||
"@babel/preset-env": "^7.23.2", | ||
"@babel/preset-react": "^7.22.15", | ||
"@babel/preset-typescript": "^7.23.0", | ||
"@types/lodash": "^4.14.199", | ||
"@types/node": "^20", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"autoprefixer": "^10", | ||
"babel-loader": "^9.1.3", | ||
"babel-plugin-transform-remove-console": "^6.9.4", | ||
"cheerio": "^1.0.0-rc.12", | ||
"clean-webpack-plugin": "^4.0.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8", | ||
"eslint-config-next": "13.5.4", | ||
"lint-staged": "^14.0.1", | ||
"postcss": "^8", | ||
"pre-commit": "^1.2.2", | ||
"prettier": "^3.0.3", | ||
"tailwindcss": "^3", | ||
"ts-loader": "^9.5.0", | ||
"typescript": "^5.2.2", | ||
"webpack": "^5.89.0", | ||
"webpack-cli": "^5.1.4" | ||
} | ||
} |