mirror of
https://github.com/strapi/strapi.git
synced 2026-01-05 11:45:51 +00:00
Remove old files
Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
parent
f22d20e61b
commit
87b8a3b4e2
@ -1,49 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* StyledListRow
|
||||
*
|
||||
*/
|
||||
|
||||
import styled from 'styled-components';
|
||||
import { CustomRow as Row } from '@buffetjs/styles';
|
||||
import { sizes } from '@strapi/helper-plugin';
|
||||
|
||||
const StyledListRow = styled(Row)`
|
||||
cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
|
||||
.checkboxWrapper {
|
||||
width: 55px;
|
||||
padding-left: 30px;
|
||||
> div {
|
||||
height: 16px;
|
||||
}
|
||||
}
|
||||
.nameWrapper {
|
||||
max-width: 158px;
|
||||
}
|
||||
.urlWrapper {
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
.switchWrapper {
|
||||
min-width: 125px;
|
||||
}
|
||||
|
||||
@media (min-width: ${sizes.wide}) {
|
||||
.urlWrapper {
|
||||
max-width: 400px;
|
||||
}
|
||||
}
|
||||
td {
|
||||
p {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
StyledListRow.defaultProps = {
|
||||
disabled: true,
|
||||
};
|
||||
|
||||
export default StyledListRow;
|
||||
@ -1,113 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* ListRow
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Checkbox, IconLinks } from '@buffetjs/core';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faPencilAlt, faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
import Switch from '../Switch';
|
||||
import StyledListRow from './StyledListRow';
|
||||
|
||||
function ListRow({
|
||||
canDelete,
|
||||
canUpdate,
|
||||
id,
|
||||
isEnabled,
|
||||
itemsToDelete,
|
||||
name,
|
||||
url,
|
||||
onCheckChange,
|
||||
onEnabledChange,
|
||||
onDeleteCLick,
|
||||
onEditClick,
|
||||
}) {
|
||||
const links = [
|
||||
{
|
||||
icon: canUpdate ? <FontAwesomeIcon icon={faPencilAlt} /> : null,
|
||||
onClick: () => onEditClick(id),
|
||||
},
|
||||
{
|
||||
icon: canDelete ? <FontAwesomeIcon icon={faTrashAlt} /> : null,
|
||||
onClick: e => {
|
||||
e.stopPropagation();
|
||||
onDeleteCLick(id);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const handleClick = () => {
|
||||
if (canUpdate) {
|
||||
onEditClick(id);
|
||||
}
|
||||
};
|
||||
|
||||
const isChecked = itemsToDelete.includes(id);
|
||||
|
||||
return (
|
||||
<StyledListRow onClick={handleClick} disabled={!canUpdate}>
|
||||
{canDelete && (
|
||||
<td className="checkboxWrapper">
|
||||
<Checkbox
|
||||
name={name}
|
||||
value={isChecked}
|
||||
onClick={e => e.stopPropagation()}
|
||||
onChange={({ target: { value } }) => onCheckChange(value, id)}
|
||||
/>
|
||||
</td>
|
||||
)}
|
||||
<td className="nameWrapper">
|
||||
<p>{name}</p>
|
||||
</td>
|
||||
<td className="urlWrapper">
|
||||
<p title={url}>{url}</p>
|
||||
</td>
|
||||
<td className="switchWrapper">
|
||||
<div onClick={e => e.stopPropagation()} role="button" aria-hidden="true">
|
||||
<Switch
|
||||
disabled={!canUpdate}
|
||||
name={name}
|
||||
value={isEnabled}
|
||||
onChange={({ target: { value } }) => onEnabledChange(value, id)}
|
||||
/>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<IconLinks links={links} />
|
||||
</td>
|
||||
</StyledListRow>
|
||||
);
|
||||
}
|
||||
|
||||
ListRow.defaultProps = {
|
||||
canDelete: false,
|
||||
canUpdate: false,
|
||||
itemsToDelete: [],
|
||||
isEnabled: false,
|
||||
name: null,
|
||||
onCheckChange: () => {},
|
||||
onDeleteCLick: () => {},
|
||||
onEditClick: () => {},
|
||||
onEnabledChange: () => {},
|
||||
url: null,
|
||||
};
|
||||
|
||||
ListRow.propTypes = {
|
||||
canDelete: PropTypes.bool,
|
||||
canUpdate: PropTypes.bool,
|
||||
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
||||
itemsToDelete: PropTypes.instanceOf(Array),
|
||||
isEnabled: PropTypes.bool,
|
||||
name: PropTypes.string,
|
||||
onCheckChange: PropTypes.func,
|
||||
onDeleteCLick: PropTypes.func,
|
||||
onEditClick: PropTypes.func,
|
||||
onEnabledChange: PropTypes.func,
|
||||
url: PropTypes.string,
|
||||
};
|
||||
|
||||
export default ListRow;
|
||||
@ -1,30 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* Toggle
|
||||
*
|
||||
*/
|
||||
|
||||
import styled from 'styled-components';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const Toggle = styled.input`
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')} !important;
|
||||
opacity: 0;
|
||||
`;
|
||||
|
||||
Toggle.defaultProps = {
|
||||
disabled: true,
|
||||
type: 'checkbox',
|
||||
};
|
||||
|
||||
Toggle.propTypes = {
|
||||
type: PropTypes.string,
|
||||
};
|
||||
|
||||
export default Toggle;
|
||||
@ -1,67 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* Wrapper
|
||||
*
|
||||
*/
|
||||
|
||||
import styled from 'styled-components';
|
||||
|
||||
const Wrapper = styled.div`
|
||||
position: relative;
|
||||
.button {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
width: 30px;
|
||||
height: 18px;
|
||||
margin-right: 12px;
|
||||
.button-rect {
|
||||
position: relative;
|
||||
z-index: -2;
|
||||
margin-top: 3px;
|
||||
width: 30px;
|
||||
height: 12px;
|
||||
background-color: #faa684;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.button-circle {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -1px;
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
border-radius: 9px;
|
||||
background-color: #f1f1f1;
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: -1;
|
||||
margin: -1px;
|
||||
border-radius: inherit;
|
||||
background: linear-gradient(to bottom, #f1f1f1, #e7e7e7);
|
||||
}
|
||||
}
|
||||
}
|
||||
input {
|
||||
z-index: 3;
|
||||
cursor: pointer;
|
||||
}
|
||||
input:checked + .button {
|
||||
.button-rect {
|
||||
background-color: #6dbb1a;
|
||||
}
|
||||
.button-circle {
|
||||
left: -1px;
|
||||
}
|
||||
}
|
||||
.button,
|
||||
p {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
`;
|
||||
|
||||
export default Wrapper;
|
||||
@ -1,51 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* Switch
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useIntl } from 'react-intl';
|
||||
|
||||
import Toggle from './Toggle';
|
||||
import Wrapper from './Wrapper';
|
||||
|
||||
function Switch({ disabled, name, value, onChange }) {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
return (
|
||||
<Wrapper>
|
||||
<Toggle
|
||||
disabled={disabled}
|
||||
checked={value}
|
||||
name={name}
|
||||
onChange={({ target: { checked } }) => onChange({ target: { name, value: checked } })}
|
||||
/>
|
||||
<div className="button">
|
||||
<div className="button-rect" />
|
||||
<div className="button-circle" />
|
||||
</div>
|
||||
<p>
|
||||
{value
|
||||
? formatMessage({ id: 'Settings.webhooks.enabled' })
|
||||
: formatMessage({ id: 'Settings.webhooks.disabled' })}
|
||||
</p>
|
||||
</Wrapper>
|
||||
);
|
||||
}
|
||||
|
||||
Switch.defaultProps = {
|
||||
disabled: true,
|
||||
onChange: () => {},
|
||||
value: false,
|
||||
};
|
||||
|
||||
Switch.propTypes = {
|
||||
disabled: PropTypes.bool,
|
||||
onChange: PropTypes.func,
|
||||
name: PropTypes.string.isRequired,
|
||||
value: PropTypes.bool,
|
||||
};
|
||||
|
||||
export default Switch;
|
||||
@ -1,4 +1,2 @@
|
||||
export { default as Inputs } from './Inputs';
|
||||
export { default as ListRow } from './ListRow';
|
||||
export { default as Switch } from './Switch';
|
||||
export { default as TriggerContainer } from './TriggerContainer';
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
import styled from 'styled-components';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const Content = styled.div`
|
||||
min-height: calc(100vh - ${props => props.theme.main.sizes.header.height});
|
||||
width: calc(100vw - ${props => props.theme.main.sizes.leftMenu.width});
|
||||
margin-top: ${props => props.theme.main.sizes.header.height};
|
||||
margin-left: ${props => props.theme.main.sizes.leftMenu.width};
|
||||
background: ${props => props.theme.main.colors.content['background-alpha']};
|
||||
`;
|
||||
|
||||
Content.defaultProps = {
|
||||
theme: {
|
||||
main: {
|
||||
colors: {
|
||||
content: {},
|
||||
},
|
||||
sizes: {
|
||||
header: {},
|
||||
leftMenu: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Content.propTypes = {
|
||||
theme: PropTypes.object,
|
||||
};
|
||||
|
||||
export default Content;
|
||||
@ -1,128 +0,0 @@
|
||||
import styled from 'styled-components';
|
||||
|
||||
const Wrapper = styled.div`
|
||||
position: relative;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
> div {
|
||||
height: 6rem;
|
||||
width: 100%;
|
||||
line-height: 5.8rem;
|
||||
z-index: 999;
|
||||
> button,
|
||||
> button.btn {
|
||||
position: relative;
|
||||
z-index: 9;
|
||||
width: 100%;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
background: white;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
color: #333740;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-align: right;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s ease-out;
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&:active {
|
||||
color: #333740;
|
||||
background-color: #fafafb !important;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
> i,
|
||||
> svg {
|
||||
margin-left: 10px;
|
||||
transition: transform 0.3s ease-out;
|
||||
|
||||
&[alt='true'] {
|
||||
transform: rotateX(180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:after {
|
||||
position: absolute;
|
||||
right: -1px;
|
||||
top: calc(50% - 10px);
|
||||
content: '';
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
height: 20px;
|
||||
border-left: 1px solid #f3f4f4;
|
||||
transition: opacity 0.2s ease-out;
|
||||
}
|
||||
|
||||
&:hover:after {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.dropDownContent {
|
||||
z-index: 8;
|
||||
top: -3px !important;
|
||||
left: auto !important;
|
||||
min-width: 190px;
|
||||
margin: 0 !important;
|
||||
padding: 0;
|
||||
line-height: 1.8rem;
|
||||
border: none !important;
|
||||
border-top-left-radius: 0 !important;
|
||||
border-top-right-radius: 0 !important;
|
||||
font-size: 14px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 1px 4px 0px rgba(40, 42, 49, 0.05);
|
||||
&:active {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -1px;
|
||||
width: calc(100% + 1px);
|
||||
height: 3px;
|
||||
box-shadow: 0 1px 2px 0 rgba(40, 42, 49, 0.16);
|
||||
}
|
||||
|
||||
> button {
|
||||
height: 54px;
|
||||
padding: 0px 15px;
|
||||
&:hover,
|
||||
&:focus,
|
||||
&:active {
|
||||
background-color: #fafafb !important;
|
||||
border-radius: 0px;
|
||||
cursor: pointer;
|
||||
outline: 0;
|
||||
}
|
||||
&:hover,
|
||||
&:active {
|
||||
color: #333740;
|
||||
}
|
||||
}
|
||||
|
||||
> button:last-child {
|
||||
color: #f75b1d;
|
||||
> i,
|
||||
svg {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
&:active {
|
||||
color: black;
|
||||
}
|
||||
&:hover {
|
||||
background-color: #fafafb !important;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export default Wrapper;
|
||||
@ -1,60 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* Logout
|
||||
*
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
import React, { useState } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { ButtonDropdown, DropdownItem, DropdownMenu, DropdownToggle } from 'reactstrap';
|
||||
import { get } from 'lodash';
|
||||
import { auth } from '@strapi/helper-plugin';
|
||||
import Wrapper from './components';
|
||||
|
||||
const Logout = ({ history: { push } }) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
const handleGoToMe = () => {
|
||||
push({
|
||||
pathname: `/me`,
|
||||
});
|
||||
};
|
||||
|
||||
const handleLogout = () => {
|
||||
auth.clearAppStorage();
|
||||
push('/auth/login');
|
||||
};
|
||||
|
||||
const toggle = () => setIsOpen(prev => !prev);
|
||||
|
||||
const userInfo = auth.getUserInfo();
|
||||
const displayName =
|
||||
userInfo && userInfo.firstname && userInfo.lastname
|
||||
? `${userInfo.firstname} ${userInfo.lastname}`
|
||||
: get(userInfo, 'username', '');
|
||||
|
||||
return (
|
||||
<Wrapper>
|
||||
<ButtonDropdown isOpen={isOpen} toggle={toggle}>
|
||||
<DropdownToggle>
|
||||
{displayName}
|
||||
<FontAwesomeIcon icon="caret-down" />
|
||||
</DropdownToggle>
|
||||
<DropdownMenu className="dropDownContent">
|
||||
<DropdownItem onClick={handleGoToMe} className="item">
|
||||
<FormattedMessage id="app.components.Logout.profile" />
|
||||
</DropdownItem>
|
||||
<DropdownItem onClick={handleLogout}>
|
||||
<FormattedMessage id="app.components.Logout.logout" />
|
||||
<FontAwesomeIcon icon="sign-out-alt" />
|
||||
</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</ButtonDropdown>
|
||||
</Wrapper>
|
||||
);
|
||||
};
|
||||
|
||||
export default withRouter(Logout);
|
||||
@ -1,27 +0,0 @@
|
||||
import styled from 'styled-components';
|
||||
|
||||
const Wrapper = styled.div`
|
||||
display: flex;
|
||||
overflow-x: hidden;
|
||||
|
||||
p,
|
||||
span {
|
||||
font-family: Lato;
|
||||
}
|
||||
|
||||
.adminPageRightWrapper {
|
||||
width: ${props => `calc(100% - ${props.theme.main.sizes.leftMenu.width})`};
|
||||
}
|
||||
`;
|
||||
|
||||
Wrapper.defaultProps = {
|
||||
theme: {
|
||||
main: {
|
||||
sizes: {
|
||||
leftMenu: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default Wrapper;
|
||||
@ -28,8 +28,6 @@ jest.mock('../../../hooks', () => ({
|
||||
}));
|
||||
|
||||
jest.mock('../../../components/LeftMenu', () => () => <div>menu</div>);
|
||||
|
||||
jest.mock('../Logout', () => () => <div>Logout</div>);
|
||||
jest.mock('../../HomePage', () => () => <div>HomePage</div>);
|
||||
|
||||
const makeApp = history => (
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* App constants
|
||||
*
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export const GET_DATA_SUCCEEDED = 'app/App/GET_DATA_SUCCEEDED';
|
||||
@ -1,25 +0,0 @@
|
||||
li.header {
|
||||
color: #101622 !important;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.07rem;
|
||||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
}
|
||||
|
||||
li.chapter > a {
|
||||
transition: background-color 0.15s ease;
|
||||
-webkit-transition: background-color 0.15s ease;
|
||||
}
|
||||
|
||||
li.chapter:hover > a {
|
||||
background: #eee !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.versions-select select {
|
||||
height: 36px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.book-summary {
|
||||
background-color: #f7f7f7 !important;
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* Wrapper
|
||||
*
|
||||
*/
|
||||
|
||||
import styled from 'styled-components';
|
||||
|
||||
const Wrapper = styled.div`
|
||||
margin-bottom: 60px;
|
||||
> div:first-of-type {
|
||||
margin-bottom: 33px;
|
||||
}
|
||||
.list-wrapper {
|
||||
border-radius: 2px;
|
||||
box-shadow: 0 2px 4px #e3e9f3;
|
||||
background: white;
|
||||
> div,
|
||||
> div > div:last-of-type {
|
||||
box-shadow: none;
|
||||
border-radius: 2px;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
}
|
||||
p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
`;
|
||||
|
||||
export default Wrapper;
|
||||
Loading…
x
Reference in New Issue
Block a user