Fix typos in frontend code
This commit is contained in:
@@ -84,7 +84,7 @@ export const unsubscribeFromEmailUpdates = () => apiFetcher.delete('/email');
|
||||
export const deleteMe = (): Promise<{ user_id: string; link: string }> => apiFetcher.post('/deleteme');
|
||||
|
||||
/* Admin Methods */
|
||||
// TODO: move these methods to separate chunk as well as all admin inteface features
|
||||
// TODO: move these methods to separate chunk as well as all admin interface features
|
||||
export const approveDeleteMe = (token: string): Promise<void> => adminFetcher.get('/deleteme', { token });
|
||||
|
||||
export const pinComment = (id: Comment['id']): Promise<void> => adminFetcher.put(`/pin/${id}`, { url, pin: 1 });
|
||||
|
||||
@@ -39,7 +39,7 @@ export const IS_STORAGE_AVAILABLE: boolean = (() => {
|
||||
|
||||
/**
|
||||
* Defines whether iframe loaded in cross origin environment
|
||||
* Usefull for checking if some privacy restriction may be applied
|
||||
* Useful for checking if some privacy restriction may be applied
|
||||
*/
|
||||
export const IS_THIRD_PARTY: boolean = (() => {
|
||||
try {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { RequestError } from 'utils/errorUtils';
|
||||
import { API_BASE, BASE_URL } from './constants.config';
|
||||
import { apiFetcher, authFetcher, adminFetcher, JWT_HEADER } from './fetcher';
|
||||
|
||||
type FetchImplementaitonProps = {
|
||||
type FetchImplementationProps = {
|
||||
status?: number;
|
||||
headers?: Record<string, string>;
|
||||
json?: () => Promise<unknown>;
|
||||
@@ -14,7 +14,7 @@ type FetchImplementaitonProps = {
|
||||
data?: unknown;
|
||||
};
|
||||
|
||||
function mockFetch({ headers = {}, data = {}, ...props }: FetchImplementaitonProps = {}) {
|
||||
function mockFetch({ headers = {}, data = {}, ...props }: FetchImplementationProps = {}) {
|
||||
window.fetch = jest.fn().mockImplementation(() => {
|
||||
return {
|
||||
status: 200,
|
||||
@@ -96,7 +96,7 @@ describe('fetcher', () => {
|
||||
});
|
||||
|
||||
describe('headers', () => {
|
||||
it('should set active token and than clean it on unauthorized respose', async () => {
|
||||
it('should set active token and than clean it on unauthorized response', async () => {
|
||||
expect.assertions(4);
|
||||
|
||||
const headersWithJwt = { [JWT_HEADER]: 'token', ...headers };
|
||||
@@ -110,7 +110,7 @@ describe('fetcher', () => {
|
||||
mockFetch({ headers, status: 401 });
|
||||
await expect(
|
||||
apiFetcher.get(apiUri).then(() => {
|
||||
throw Error('apiFether shoud throw error on 401 responce');
|
||||
throw Error('apiFetcher should throw error on 401 response');
|
||||
})
|
||||
).rejects.toEqual(new Error('Not authorized.'));
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('getJsonItem', () => {
|
||||
expect(localStorage.getItem(LS_KEY)).toBe('{}');
|
||||
});
|
||||
|
||||
it('should update json in localStoeage', () => {
|
||||
it('should update json in localStorage', () => {
|
||||
setJsonItem(LS_KEY, []);
|
||||
expect(localStorage.getItem(LS_KEY)).toBe('[]');
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ import { QuerySettingsType, querySettings } from './settings';
|
||||
interface StaticStoreType {
|
||||
config: Config;
|
||||
query: QuerySettingsType;
|
||||
/** used in fetcher, fer example to set comment edit temiout */
|
||||
/** used in fetcher, fer example to set comment edit timeout */
|
||||
serverClientTimeDiff?: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ export interface Comment {
|
||||
/**
|
||||
* @ClientOnly defines whether comments was hidden (deleted)
|
||||
*
|
||||
* Situatuon may occure for example if user decided to hide someone,
|
||||
* Situation may occur for example if user decided to hide someone,
|
||||
* in this case we don't use `delete` field because comment with `delete`
|
||||
* still renders, and comment with `hidden` flag completely removed from DOM
|
||||
*/
|
||||
|
||||
@@ -161,7 +161,7 @@ describe('<Auth/>', () => {
|
||||
|
||||
expect(getByText('Back')).toHaveClass('auth-back-button');
|
||||
expect(getByTitle('Close sign-in dropdown')).toHaveClass('auth-close-button');
|
||||
expect(getByPlaceholderText('Token')).toHaveClass('auth-token-textatea');
|
||||
expect(getByPlaceholderText('Token')).toHaveClass('auth-token-textarea');
|
||||
|
||||
fireEvent.change(getByPlaceholderText('Token'), {
|
||||
target: { value: 'token' },
|
||||
@@ -189,7 +189,7 @@ describe('<Auth/>', () => {
|
||||
|
||||
expect(getByText('Back')).toHaveClass('auth-back-button');
|
||||
expect(getByTitle('Close sign-in dropdown')).toHaveClass('auth-close-button');
|
||||
expect(getByPlaceholderText('Token')).toHaveClass('auth-token-textatea');
|
||||
expect(getByPlaceholderText('Token')).toHaveClass('auth-token-textarea');
|
||||
|
||||
fireEvent.change(getByPlaceholderText('Token'), { target: { value: 'token' } });
|
||||
fireEvent.click(getByText('Submit'));
|
||||
@@ -220,7 +220,7 @@ describe('<Auth/>', () => {
|
||||
${'username '} | ${'username'}
|
||||
${' username'} | ${'username'}
|
||||
${' username '} | ${'username'}
|
||||
`('should remove spaces in the first/last postion in username', async ({ value, expected }) => {
|
||||
`('should remove spaces in the first/last position in username', async ({ value, expected }) => {
|
||||
StaticStore.config.auth_providers = ['email'];
|
||||
|
||||
const { getByText, getByPlaceholderText } = render(<Auth />);
|
||||
|
||||
@@ -22,13 +22,13 @@ import styles from './auth.module.css';
|
||||
|
||||
export function Auth() {
|
||||
const intl = useIntl();
|
||||
const dispath = useDispatch();
|
||||
const dispatch = useDispatch();
|
||||
const [oauthProviders, formProviders] = getProviders();
|
||||
|
||||
// UI State
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [view, setView] = useState<typeof formProviders[number] | 'token'>(formProviders[0]);
|
||||
const [ref, isDropdownShowed, toggleDropdownState] = useDropdown(view === 'token');
|
||||
const [ref, isDropdownShown, toggleDropdownState] = useDropdown(view === 'token');
|
||||
|
||||
// Errors
|
||||
const [invalidReason, setInvalidReason] = useState<keyof typeof messages | null>(null);
|
||||
@@ -64,7 +64,7 @@ export function Auth() {
|
||||
const username = data.get('username') as string;
|
||||
const user = await anonymousSignin(username);
|
||||
|
||||
dispath(setUser(user));
|
||||
dispatch(setUser(user));
|
||||
break;
|
||||
}
|
||||
case 'email': {
|
||||
@@ -83,7 +83,7 @@ export function Auth() {
|
||||
setInvalidReason(invalidReason);
|
||||
} else {
|
||||
const user = await verifyEmailSignin(token);
|
||||
dispath(setUser(user));
|
||||
dispatch(setUser(user));
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -116,10 +116,10 @@ export function Auth() {
|
||||
);
|
||||
return (
|
||||
<div className={clsx('auth', styles.root)}>
|
||||
<Button className="auth-button" selected={isDropdownShowed} onClick={handleClickSingIn} suffix={<ArrowIcon />}>
|
||||
<Button className="auth-button" selected={isDropdownShown} onClick={handleClickSingIn} suffix={<ArrowIcon />}>
|
||||
{intl.formatMessage(messages.signin)}
|
||||
</Button>
|
||||
{isDropdownShowed && (
|
||||
{isDropdownShown && (
|
||||
<div className={clsx('auth-dropdown', styles.dropdown)} ref={ref}>
|
||||
<form className={clsx('auth-form', styles.form)} onSubmit={handleSubmit}>
|
||||
{isTokenView ? (
|
||||
@@ -157,7 +157,7 @@ export function Auth() {
|
||||
<div className={clsx('auth-row', styles.row)}>
|
||||
<TextareaAutosize
|
||||
name="token"
|
||||
className={clsx('auth-token-textatea', styles.textarea)}
|
||||
className={clsx('auth-token-textarea', styles.textarea)}
|
||||
placeholder={intl.formatMessage(messages.token)}
|
||||
disabled={isLoading}
|
||||
/>
|
||||
|
||||
@@ -23,10 +23,10 @@ type Props = {
|
||||
|
||||
export function OAuth({ providers }: Props) {
|
||||
const intl = useIntl();
|
||||
const dispath = useDispatch();
|
||||
const dispatch = useDispatch();
|
||||
const theme = useTheme();
|
||||
const buttonVariant = getButtonVariant(providers.length);
|
||||
const handleOathClick: JSX.GenericEventHandler<HTMLAnchorElement> = async (evt) => {
|
||||
const handleOauthClick: JSX.GenericEventHandler<HTMLAnchorElement> = async (evt) => {
|
||||
const { href } = evt.currentTarget as HTMLAnchorElement;
|
||||
|
||||
evt.preventDefault();
|
||||
@@ -36,7 +36,7 @@ export function OAuth({ providers }: Props) {
|
||||
return;
|
||||
}
|
||||
|
||||
dispath(setUser(user));
|
||||
dispatch(setUser(user));
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -50,7 +50,7 @@ export function OAuth({ providers }: Props) {
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={`${BASE_URL}/auth/${p}/login?from=${location}&site=${siteId}`}
|
||||
onClick={handleOathClick}
|
||||
onClick={handleOauthClick}
|
||||
className={clsx('oauth-button', styles.button, styles[buttonVariant], styles[p])}
|
||||
data-provider-name={name}
|
||||
title={intl.formatMessage(messages.oauthTitle, { provider: name })}
|
||||
|
||||
@@ -45,7 +45,7 @@ export type CommentFormProps = {
|
||||
export type CommentFormState = {
|
||||
preview: string | null;
|
||||
isErrorShown: boolean;
|
||||
/** error message, if contains newlines, it will be splitted to multiple errors */
|
||||
/** error message, if contains newlines, it will be split to multiple errors */
|
||||
errorMessage: string | null;
|
||||
/** prevents error hiding on input event */
|
||||
errorLock: boolean;
|
||||
|
||||
@@ -276,7 +276,7 @@ describe('<Comment />', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('shoud not be editable', () => {
|
||||
it('should not be editable', () => {
|
||||
StaticStore.config.edit_duration = 300;
|
||||
|
||||
const component = mountComment({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* connected comment is not exported in index.ts to avoid leaking redux import into last-comments
|
||||
* and should be importded explicitly
|
||||
* and should be imported explicitly
|
||||
*/
|
||||
|
||||
import './styles';
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
.rootDisapear {
|
||||
.rootDisappear {
|
||||
transition: transform 0.5s ease-in;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export function Profile() {
|
||||
const rootElement = rootRef.current;
|
||||
|
||||
rootElement.classList.remove(styles.rootAppear);
|
||||
rootElement.classList.add(styles.rootDisapear);
|
||||
rootElement.classList.add(styles.rootDisappear);
|
||||
// No need to unsubscribe because iframe will be destroyed
|
||||
rootElement.addEventListener('transitionend', () => {
|
||||
postMessageToParent({ profile: null });
|
||||
@@ -202,7 +202,7 @@ export function Profile() {
|
||||
<FormattedMessage id="profile.request-to-delete-data" defaultMessage="Request my data removal" />
|
||||
</Button>
|
||||
</footer>
|
||||
) : // TODO: implement hidding user comments
|
||||
) : // TODO: implement hiding user comments
|
||||
null}
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
@@ -34,7 +34,7 @@ describe('<Select/>', () => {
|
||||
expect(selectedOption?.textContent).toBe(items[0].label);
|
||||
});
|
||||
|
||||
it('should highlight selet on focus', async () => {
|
||||
it('should highlight select on focus', async () => {
|
||||
const { container } = render(<Select items={items} selected={items[0]} />);
|
||||
const select = container.querySelector('select');
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ function createFragment(params: Profile & Record<string, string | unknown>) {
|
||||
}
|
||||
|
||||
root.appendChild(iframe);
|
||||
setStyles(root, styles.rootShowed);
|
||||
setStyles(root, styles.rootShown);
|
||||
setTimeout(() => iframe?.focus());
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ const styles = {
|
||||
opacity: 0,
|
||||
zIndex: 99999999,
|
||||
},
|
||||
rootShowed: {
|
||||
rootShown: {
|
||||
display: 'block',
|
||||
},
|
||||
rootHidden: {
|
||||
|
||||
@@ -109,15 +109,15 @@ export function unsetCommentMode(mode: StoreState['comments']['activeComment'] =
|
||||
}
|
||||
|
||||
export function updateSorting(sort: Sorting): StoreAction<void> {
|
||||
return async (dispath, getState) => {
|
||||
return async (dispatch, getState) => {
|
||||
const { sort: prevSort } = getState().comments;
|
||||
dispath({ type: COMMENTS_SET_SORT, payload: sort });
|
||||
dispatch({ type: COMMENTS_SET_SORT, payload: sort });
|
||||
|
||||
try {
|
||||
await dispath(fetchComments(sort));
|
||||
await dispatch(fetchComments(sort));
|
||||
setItem(LS_SORT_KEY, sort);
|
||||
} catch (e) {
|
||||
dispath({ type: COMMENTS_SET_SORT, payload: prevSort });
|
||||
dispatch({ type: COMMENTS_SET_SORT, payload: prevSort });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -41,7 +41,7 @@ declare global {
|
||||
}
|
||||
|
||||
/**
|
||||
* Veriable responsive for dynamic setting public path for
|
||||
* Variable responsive for dynamic setting public path for
|
||||
* assets. Dynamic imports with relative url will be resolved over this path.
|
||||
*
|
||||
* https://webpack.js.org/guides/public-path/#on-the-fly
|
||||
|
||||
@@ -319,8 +319,8 @@
|
||||
words <em>italic</em>: surround them with one asterisk *.
|
||||
</p>
|
||||
<p>
|
||||
You can even <a href="http://google.com" target="_blank">link to Google!</a> using this syntax:<br />
|
||||
[link to Google!](http://google.com)
|
||||
You can even <a href="https://google.com" target="_blank">link to Google!</a> using this syntax:<br />
|
||||
[link to Google!](https://google.com)
|
||||
</p>
|
||||
|
||||
<h2 id="Lists">Lists</h2>
|
||||
|
||||
@@ -48,7 +48,7 @@ function getLocalIdent(loaderContext, _, localName, options) {
|
||||
* Generates excludes for babel-loader
|
||||
*
|
||||
* Exclude is a module that has >=es6 code and resides in node_modules.
|
||||
* By defaut babel-loader ignores everything from node_modules,
|
||||
* By default babel-loader ignores everything from node_modules,
|
||||
* so we have to exclude from ignore these modules
|
||||
*/
|
||||
const exclude = [
|
||||
@@ -74,11 +74,11 @@ const htmlMinifyOptions = {
|
||||
module.exports = (_, { mode, analyze }) => {
|
||||
const isDev = mode === 'development';
|
||||
// Use REMARK_URL or predefined host in dev environment
|
||||
// In development: We use `http://127.0.0.1:9000` for access to backend and backend is accessable via dev server proxy
|
||||
// In development: We use `http://127.0.0.1:9000` for access to backend and backend is accessible via dev server proxy
|
||||
// In production: {% REMARK_URL %} will be replaced by `sed` on start of prod
|
||||
const REMARK_URL = isDev ? DEVSERVER_BASE_PATH : '{% REMARK_URL %}';
|
||||
|
||||
// Add debug lib only for developmet throw webpack chuncks and keep code clear
|
||||
// Add debug lib only for development throw webpack chunks and keep code clear
|
||||
const preactDebug = isDev ? ['preact/debug'] : [];
|
||||
|
||||
const entry = {
|
||||
|
||||
Reference in New Issue
Block a user