Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump url-parse from 1.5.3 to 1.5.10 #46

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"rimraf": "^2.6.1",
"scratch-audio": "0.1.0-prerelease.20200528195344",
"scratch-blocks": "0.1.0-prerelease.20210829081240",
"scratch-l10n":"github:open-scratch/easy-scratch-l10n#simplify",
"scratch-l10n": "3.14.20210922031532",
"scratch-paint": "0.2.0-prerelease.20210907080144",
"scratch-render": "0.1.0-prerelease.20210819221425",
"scratch-render-fonts": "1.0.0-prerelease.20210401210003",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import "../../css/colors.css";

.profile-button {
.custom-button {
/* background: $data-primary; */
margin: 0 10px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import PropTypes from 'prop-types';
import React from 'react';
import Button from '../button/button.jsx';

import styles from './profile-button.css';
import styles from './custom-button.css';

const ProfileButton = ({
const CustomButton = ({
className,
style,
onClick,
Expand All @@ -15,23 +15,23 @@ const ProfileButton = ({
<Button
className={classNames(
className,
styles.profileButton
styles.customButton
)}
style={style}
onClick={onClick}
>
{buttonName ? buttonName: "个人中心"}
{buttonName}
</Button>
);

ProfileButton.propTypes = {
CustomButton.propTypes = {
className: PropTypes.string,
onClick: PropTypes.func,
buttonName: PropTypes.string
};

ProfileButton.defaultProps = {
CustomButton.defaultProps = {
onClick: () => {}
};

export default ProfileButton;
export default CustomButton;
14 changes: 9 additions & 5 deletions src/components/menu-bar/menu-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Box from '../box/box.jsx';
import Button from '../button/button.jsx';
import CommunityButton from './community-button.jsx';
import ShareButton from './share-button.jsx';
import ProfileButton from './profile-button.jsx';
import CustomButton from './custom-button.jsx';
import {ComingSoonTooltip} from '../coming-soon/coming-soon.jsx';
import Divider from '../divider/divider.jsx';
import LanguageSelector from '../../containers/language-selector.jsx';
Expand Down Expand Up @@ -412,7 +412,9 @@ class MenuBar extends React.Component {
/>
</div>
)}
{(this.props.canChangeLanguage) && (<div
{(this.props.canChangeLanguage &&
(window.scratchConfig && window.scratchConfig.menuBar && window.scratchConfig.menuBar.languageButton &&
window.scratchConfig.menuBar.languageButton.show)) && (<div
className={classNames(styles.menuBarItem, styles.hoverable, styles.languageMenu)}
>
<div>
Expand Down Expand Up @@ -620,7 +622,7 @@ class MenuBar extends React.Component {

<div className={classNames(styles.menuBarItem)}>
{
(window.scratchConfig && window.scratchConfig.profileButton && window.scratchConfig.profileButton.show) && (<ProfileButton
(window.scratchConfig && window.scratchConfig.profileButton && window.scratchConfig.profileButton.show) && (<CustomButton
className={styles.menuBarButton}
onClick = {
() => {
Expand All @@ -634,13 +636,15 @@ class MenuBar extends React.Component {
(window.scratchConfig && window.scratchConfig.menuBar && window.scratchConfig.menuBar.customButtons && window.scratchConfig.menuBar.customButtons.length>0) && (
window.scratchConfig.menuBar.customButtons.map(item=> {
if(item.show){
return <ProfileButton
return <CustomButton
key={item.buttonName}
className={styles.menuBarButton}
style={item.style || {}}
onClick = {() => {item.handleClick();}}
onClick = {item.handleClick}
buttonName = {item.buttonName}
/>
}else{
return ""
}
})
)
Expand Down
12 changes: 11 additions & 1 deletion src/lib/app-state-hoc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ const AppStateHOC = function (WrappedComponent, localesOnly) {
let enhancer;

let initializedLocales = localesInitialState;
const locale = detectLocale(Object.keys(locales));
let locale;
if(window.scratchConfig && window.scratchConfig.menuBar && window.scratchConfig.menuBar.languageButton &&
window.scratchConfig.menuBar.languageButton.defaultLanguage){
window.scratchConfig.menuBar.languageButton.defaultLanguage
locale = window.scratchConfig.menuBar.languageButton.defaultLanguage
}else{
locale = detectLocale(Object.keys(locales));
}

if (locale !== 'en') {
initializedLocales = initLocale(initializedLocales, locale);
}
Expand Down Expand Up @@ -103,6 +111,8 @@ const AppStateHOC = function (WrappedComponent, localesOnly) {
var event = new CustomEvent('setFullScreen', {"detail": {isFullScreen: isFullScreen}});
document.dispatchEvent(event);
}


}
componentDidUpdate (prevProps) {
if (localesOnly) return;
Expand Down
5 changes: 5 additions & 0 deletions src/playground/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
style: {
background: 'hsla(215, 100%, 65%, 1)',
},
//切换语言按钮
languageButton:{
show: true, //是否显示
defaultLanguage: 'zh-cn' //默认语言 en zh-cn zh-tw
},
//新建按钮
newButton:{
show: true, //是否显示
Expand Down
25 changes: 13 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3269,15 +3269,6 @@ duplexify@^3.4.2, duplexify@^3.6.0:
readable-stream "^2.0.0"
stream-shift "^1.0.0"

"scratch-l10n@github:open-scratch/easy-scratch-l10n#simplify":
version "3.14.0"
resolved "https://codeload.github.com/open-scratch/easy-scratch-l10n/tar.gz/7f4c97e8ac32122f17ee9a0e6a70b246d2b9f4eb"
dependencies:
"@babel/cli" "^7.1.2"
"@babel/core" "^7.1.2"
babel-plugin-react-intl "^3.0.1"
transifex "1.6.6"

ecc-jsbn@~0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
Expand Down Expand Up @@ -8653,6 +8644,16 @@ [email protected]:
babel-plugin-react-intl "^3.0.1"
transifex "1.6.6"

[email protected]:
version "3.14.20210922031532"
resolved "https://registry.yarnpkg.com/scratch-l10n/-/scratch-l10n-3.14.20210922031532.tgz#8c41da4170ec2c91c455688ba80926fbc9dbb81f"
integrity sha512-LxwHhsxkZR5veFpDMC8wAItGMKVj8+Q33B5RiqWhH/zzx5Qq7/ON9AyGOZ0NF736U70TqjWvV1ZX4lP+GsEjBg==
dependencies:
"@babel/cli" "^7.1.2"
"@babel/core" "^7.1.2"
babel-plugin-react-intl "^3.0.1"
transifex "1.6.6"

[email protected]:
version "0.2.0-prerelease.20210907080144"
resolved "https://registry.yarnpkg.com/scratch-paint/-/scratch-paint-0.2.0-prerelease.20210907080144.tgz#6b14768c5ff9f63ae1a986888f6fec2fb82a99de"
Expand Down Expand Up @@ -9897,9 +9898,9 @@ urix@^0.1.0:
integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=

url-parse@^1.4.3, url-parse@^1.5.3:
version "1.5.3"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.3.tgz#71c1303d38fb6639ade183c2992c8cc0686df862"
integrity sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==
version "1.5.10"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1"
integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==
dependencies:
querystringify "^2.1.1"
requires-port "^1.0.0"
Expand Down