Skip to content

Commit ca03d45

Browse files
Merge branch 'master' into bugfix-klappy-files-not-authenticated
2 parents e1a7b41 + 3682c6d commit ca03d45

File tree

8 files changed

+1715
-1682
lines changed

8 files changed

+1715
-1682
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Install, Build & Run Cypress
22

33
on: [push]
44
env:
5-
CHILD_CONCURRENCY: 1
65
NODE_ENV: test
6+
ACTIONS_ALLOW_UNSECURE_COMMANDS: ${{ secrets.ACTIONS_ALLOW_UNSECURE_COMMANDS }}
77
CYPRESS_DASHBOARD_KEY: ${{ secrets.CYPRESS_DASHBOARD_KEY }}
88
CYPRESS_TEST_USERNAME: ${{ secrets.CYPRESS_TEST_USERNAME }}
99
CYPRESS_TEST_PASSWORD: ${{ secrets.CYPRESS_TEST_PASSWORD }}

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gitea-react-toolkit",
3-
"version": "1.3.12",
3+
"version": "1.3.14-rc.1",
44
"license": "MIT",
55
"description": "A Gitea API React Toolkit Component Library",
66
"homepage": "https://gitea-react-toolkit.netlify.com/",
@@ -16,9 +16,8 @@
1616
"base-64": "0.1.0",
1717
"jszip": "^3.5.0",
1818
"localforage": "1.7.3",
19-
"markdown-translatable": "^1.2.1",
19+
"markdown-translatable": "1.2.8",
2020
"prop-types": "15.7.2",
21-
"react-json-view": "^1.19.1",
2221
"use-deep-compare-effect": "^1.3.1",
2322
"utf8": "3.0.0"
2423
},
@@ -57,7 +56,7 @@
5756
"@material-ui/core": "^4.7.0",
5857
"@material-ui/icons": "^4.9.1",
5958
"@types/base-64": "0.1.3",
60-
"@types/cypress": "^1.1.3",
59+
"@types/cypress": "1.1.3",
6160
"@types/jest": "^25.2.1",
6261
"@types/utf8": "2.1.6",
6362
"@typescript-eslint/eslint-plugin": "2.7.0",
@@ -68,7 +67,7 @@
6867
"babel-loader": "^8.0.6",
6968
"babel-plugin-istanbul": "6.0.0",
7069
"coveralls": "3.0.7",
71-
"cypress": "^5.1.0",
70+
"cypress": "6.2.1",
7271
"eslint": "6.6.0",
7372
"eslint-config-prettier": "6.5.0",
7473
"eslint-plugin-chai-friendly": "0.5.0",

src/components/application-bar/ApplicationBar.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515

1616
function ApplicationBar({
1717
title,
18+
build,
1819
buttons,
1920
drawerMenu,
2021
drawerMenuProps,
@@ -35,6 +36,7 @@ function ApplicationBar({
3536
</div>
3637
<Typography variant="h6" color="inherit" className={classes.grow} noWrap>
3738
{title}
39+
{build && <Typography variant="caption" color="inherit" > build {build}</Typography>}
3840
</Typography>
3941
<Typography variant="subtitle2" color="inherit" className={classes.grow} noWrap>
4042
{file ? file.filepath : ''}

src/components/authentication/useAuthentication.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,6 @@ function useAuthentication({
6363
}
6464
}, [authentication, loadAuthentication, update]);
6565

66-
const onSubmit = useCallback(async ({
67-
username, password, remember,
68-
}) => {
69-
if (authentication) {
70-
logout();
71-
update();
72-
} else {
73-
await onSubmitLogin({ username, password, remember });
74-
}
75-
}, [authentication, config, logout, update, onSubmitLogin]);
76-
7766
const onSubmitLogin = useCallback(async ({
7867
username, password, remember,
7968
}) => {
@@ -110,6 +99,17 @@ function useAuthentication({
11099
messages.genericError, messages.networkError, messages.passwordError, messages.serverError, messages.usernameError,
111100
]);
112101

102+
const onSubmit = useCallback(async ({
103+
username, password, remember,
104+
}) => {
105+
if (authentication) {
106+
logout();
107+
update();
108+
} else {
109+
await onSubmitLogin({ username, password, remember });
110+
}
111+
}, [authentication, config, logout, update, onSubmitLogin]);
112+
113113
const component = useMemo(() => (
114114
config && (
115115
<LoginForm

src/components/core/Core.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { useState, useCallback } from 'react';
22
import PropTypes from 'prop-types';
3-
import ReactJson from 'react-json-view';
43
import { Paper, Button } from '@material-ui/core';
54

65
import { useAuthentication } from '..';
@@ -37,17 +36,17 @@ function Core({
3736
}
3837

3938
if (response) {
40-
responseComponent = <ReactJson src={response} />;
39+
responseComponent = <div>{JSON.stringify(response)}</div>;
4140
} else if (loading) {
42-
responseComponent = <ReactJson src={{ pending: true }} />;
41+
responseComponent = <div/>;
4342
} else if (!response && typeof (response) !== 'undefined' && !loading) {
4443
responseComponent = 'No response';
4544
}
4645
return (
4746
<>
4847
<h3>Props</h3>
4948
<Paper>
50-
<ReactJson src={props} />
49+
<div>{JSON.stringify(props)}</div>
5150
</Paper>
5251
<h3>Response</h3>
5352
<Paper>

src/components/repositories/SearchForm.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ The SearchForm component will make a search api call and return the resulting re
33
```js
44
import { useState } from 'react';
55
import { Paper } from '@material-ui/core';
6-
import ReactJson from 'react-json-view';
76
import { SearchForm } from 'gitea-react-toolkit';
87

98
const [repos, setRepos] = useState([]);
@@ -20,7 +19,7 @@ const [repos, setRepos] = useState([]);
2019
</Paper>
2120
<h3>Search Results:</h3>
2221
<Paper style={{maxHeight: '300px', overflow: 'scroll'}}>
23-
<ReactJson src={repos} />
22+
<pre>{JSON.stringify(repos)}</pre>
2423
</Paper>
2524
</div>
2625
```

src/core/localStrings.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ const strings = {
1212
};
1313

1414
export const localString = (id) => {
15-
let lang = navigator.language.split(/-|_/)[0];
15+
let lang = null;
16+
17+
if (typeof window !== 'undefined' )
18+
{
19+
if (navigator) {
20+
lang = navigator.language.split(/-|_/)[0];
21+
}
22+
}
1623
// if language is unknown (not sure this can actually happen)
17-
if ( lang === undefined ) {
24+
if (!lang) {
1825
lang = 'en';
1926
}
2027
// if there are no strings for the language

0 commit comments

Comments
 (0)