...
 
Commits (3)
window.env = {
// MEDIA
// Online Simcaa.it
"PathImages": "http://www.simcaa.it/demo/media/symbols/",
// "PathImages": "http://www.simcaa.it/demo/media/symbols/",
"CustomImage": "http://www.simcaa.it/demo/media/custom/",
"ApiImageUpload": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/imageupload",
// "ApiImageUpload": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/imageupload",
// "ApiSymbolUpload": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/imageuploadtmp",
"MediaImage": "http://www.simcaa.it/demo/media/images/",
"TmpImage": "http://www.simcaa.it/demo/media/tmp/",
"ApiImageUpload": "http://www.simcaa.it/demo2/apisimcaa-graphql/public/graphql/imageupload",
"ApiSymbolUpload": "http://www.simcaa.it/demo2/apisimcaa-graphql/public/graphql/imageuploadtmp",
// Local
"PathImages": "http://10.0.0.132/media/symbols/",
// "CustomImage": "http://10.0.0.132/media/custom/",
// "ApiImageUpload": "http://10.0.0.132:8085/graphql/imageupload",
// "ApiSymbolUpload": "http://10.0.0.132:8085/graphql/imageuploadtmp",
// "MediaImage": "http://10.0.0.132/media/images/",
// URL
// Online Simcaa.it
/*"GraphQLServer": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/query",
"GraphQLServerNoAuth": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/query/noauth",
"GraphQLLogin": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/login",
"GraphQLCurrentUser": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/me",
"GraphQLRefreshToken": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/jwtrefresh",
"RestApiCard": "http://www.simcaa.it/demo/apisimcaa-graphql/public/graphql/card",*/
// "TmpImage": "http://10.0.0.132/media/tmp/",
// TEMP: DEMO2 (DELETE LATER)
// Online Simcaa.it
/*"GraphQLServer": "http://www.simcaa.it/demo2/apisimcaa-graphql/public/graphql/query",
"GraphQLServer": "http://www.simcaa.it/demo2/apisimcaa-graphql/public/graphql/query",
"GraphQLServerNoAuth": "http://www.simcaa.it/demo2/apisimcaa-graphql/public/graphql/query/noauth",
"GraphQLLogin": "http://www.simcaa.it/demo2/apisimcaa-graphql/public/graphql/login",
"GraphQLCurrentUser": "http://www.simcaa.it/demo2/apisimcaa-graphql/public/graphql/me",
"GraphQLRefreshToken": "http://www.simcaa.it/demo2/apisimcaa-graphql/public/graphql/jwtrefresh",
"RestApiCard": "http://www.simcaa.it/demo2/apisimcaa-graphql/public/graphql/card",*/
"RestApiCard": "http://www.simcaa.it/demo2/apisimcaa-graphql/public/graphql/card",
// Local
"GraphQLServer": "http://10.0.0.132:8085/graphql/query",
"GraphQLServerNoAuth": "http://10.0.0.132:8085/graphql/query/noauth",
"GraphQLLogin": "http://10.0.0.132:8085/graphql/login",
"GraphQLCurrentUser": "http://10.0.0.132:8085/graphql/me",
"GraphQLRefreshToken": "http://10.0.0.132:8085/graphql/jwtrefresh",
"RestApiCard": "http://10.0.0.132:8085/graphql/card",
// "GraphQLServer": "http://10.0.0.132:8085/graphql/query",
// "GraphQLServerNoAuth": "http://10.0.0.132:8085/graphql/query/noauth",
// "GraphQLLogin": "http://10.0.0.132:8085/graphql/login",
// "GraphQLCurrentUser": "http://10.0.0.132:8085/graphql/me",
// "GraphQLRefreshToken": "http://10.0.0.132:8085/graphql/jwtrefresh",
// "RestApiCard": "http://10.0.0.132:8085/graphql/card",
// CSS - remote
// "SemanticCSS": "http://10.0.0.132/includes/css/semantic.min.css",
......
public/favicon.ico

3.78 KB | W: | H:

public/favicon.ico

16.6 KB | W: | H:

public/favicon.ico
public/favicon.ico
public/favicon.ico
public/favicon.ico
  • 2-up
  • Swipe
  • Onion skin
......@@ -15,6 +15,7 @@ window.language = {
"MAIN_TBL_NOTES": "Note",
"MAIN_TBL_SHARE": "Condivisione",
"MAIN_TBL_USEROWN": "Proprietario",
"MAIN_TBL_TEAMOWN": "Team",
"MAIN_TBL_PUBLIC": "Pubblico",
"MAIN_TBL_PRIVATE": "Privato",
"MAIN_TBL_ACTIONS": "Azioni",
......@@ -26,7 +27,7 @@ window.language = {
"MAIN_FRM_LAYOUT": "Layout del Progetto",
"MAIN_FRM_PLACEHOLDER_LAYOUT": "Impossile cambiare il layout adesso",
"MAIN_FRM_SHARE": "Progetto pubblico o privato",
"MAIN_FRM_PUBLIC": "Rendi questo Progetto pubblico",
"MAIN_FRM_PRIVATE": "Rendi questo progetto privato",
"MAIN_FRM_NOTES": "Note del Progetto",
"MAIN_BTN_CREATE": "Crea il Progetto",
"MAIN_BTN_UPDATE": "Aggiorna il Progetto",
......@@ -324,6 +325,7 @@ window.language = {
"MAIN_TBL_NOTES": "Notes",
"MAIN_TBL_SHARE": "Share",
"MAIN_TBL_USEROWN": "User Owner",
"MAIN_TBL_TEAMOWN": "Team Owner",
"MAIN_TBL_PUBLIC": "Public",
"MAIN_TBL_PRIVATE": "Private",
"MAIN_TBL_ACTIONS": "Actions",
......@@ -335,7 +337,7 @@ window.language = {
"MAIN_FRM_LAYOUT": "Project layout",
"MAIN_FRM_PLACEHOLDER_LAYOUT": "Cannot change layout now",
"MAIN_FRM_SHARE": "Project private or public",
"MAIN_FRM_PUBLIC": "Make this Project public",
"MAIN_FRM_PRIVATE": "Make this project private",
"MAIN_FRM_NOTES": "Project notes",
"MAIN_BTN_CREATE": "Create Project",
"MAIN_BTN_UPDATE": "Update Project",
......
......@@ -18,6 +18,7 @@
:root {
--margin-card: 15px 0px 0px 20px;
--initial-margin-card-group: 0px;
}
.ui.label {
......@@ -308,3 +309,18 @@ body > div > div div > div.login-form { */
.ui.dimmer>.content>* {
display: inline;
}
/* Fix for card input min width */
input {
min-width: 20px;
}
/* Fix for card distance from border */
.cardLine {
margin-left: var(--initial-margin-card-group) !important;
}
/* Fix for icon dimension in homepage header project */
.ui.header > .icon {
font-size: 2em;
}
......@@ -29,9 +29,7 @@ class App extends Component {
return (
<HashRouter>
<div>
<Route exact path="/" render={() => (
<Redirect to="/home" />
)}/>
<Route exact path="/" render={() => (<Redirect to="/home" />)}/>
<Route path="/home" render={this.isLogged.bind(this, RootComponent)}/>
<Route path="/basic/:mode?/:projectid?/:chapterid?" render={this.isLogged.bind(this, BasicProject)} />
<Route path="/project/:projectid?" render={this.isLogged.bind(this, Project)} />
......
......@@ -28,10 +28,10 @@ class NewUserForm extends Component{
this.setState({loading: true});
let query = `
query{
groups{
roles{
data {
id
desc_group
role_desc
}
}
team{
......@@ -43,10 +43,10 @@ class NewUserForm extends Component{
}`;
this.props.apolloFetch({query}).then((data)=>{
let tmp = []
data.data.groups.data.map((group)=>{
data.data.roles.data.map((role)=>{
tmp.push({
text: group.desc_group,
value: group.id
text: role.role_desc,
value: role.id
})
return null;
});
......
import React, { Component } from 'react'
import { Button, Form, Segment, Grid, Message } from 'semantic-ui-react'
import { Button, Form, Segment, Grid, Message, Image } from 'semantic-ui-react'
import logo from '../assets/simcaa.png'
class LoginForm extends Component {
constructor(props) {
......@@ -48,11 +50,21 @@ class LoginForm extends Component {
<Grid.Column style={{ maxWidth: 450 }}>
<Form size='large' id='login' error={this.props.message.view}>
<Segment raised color='green'>
<Message
error={this.props.message.view}
header={this.props.message.header}
content={this.props.message.text}
/>
{
// TODO: DELETE WHEN LOGO WORKS
// <Message
// error={this.props.message.view}
// header={this.props.message.header}
// content={this.props.message.text}
// />
}
<Message error={this.props.message.view}>
<Message.Header>{this.props.message.header}</Message.Header>
{
// <Image size='tiny' src={logo} />
}
{this.props.message.text}
</Message>
<Form.Input
fluid
icon='user'
......
......@@ -3,7 +3,7 @@ import { Menu, Dropdown } from 'semantic-ui-react'
import { translate, Trans } from 'react-i18next'
import { Link, withRouter } from 'react-router-dom'
import UploadSymbol from '../../UploadSymbol'
import UploadSymbol from '../../containers/UploadSymbol'
import LanguageSwitcher from '../../LanguageSwitcher'
import NewProfileForm from '../../containers/homepage/NewProfileForm'
import TeamSwitcher from '../../containers/switcher/TeamSwitcher'
......@@ -19,7 +19,7 @@ class HomepageProject extends Component {
const { t, i18n } = this.props
let dropdownOptions = ''
if (this.props.user.group_id === 1) {
if (this.props.user.role_id === 1) {
dropdownOptions = <Dropdown.Item as={Link} to="/administration">Admin</Dropdown.Item>
}
return (
......
......@@ -15,11 +15,10 @@ class HomepageProjectTable extends Component {
displayFilter: false,
// Pagination state variables
currentPage: 1,
totalPages: 5,
total: 0,
limit: 15,
page: 1,
page: props.page,
// Sort Table variables
direction: 'ascending',
......@@ -89,6 +88,7 @@ class HomepageProjectTable extends Component {
render() {
const { t, i18n } = this.props
let numColumnsTable = 7
let allProjects = this.state.projects
allProjects = allProjects.map((item, index) => {
......@@ -96,13 +96,12 @@ class HomepageProjectTable extends Component {
<Table.Row key={index}>
<Table.Cell collapsing>{item.proj_id}</Table.Cell>
<Table.Cell collapsing>
<Link to={'/project/' + item.proj_id}>
{item.proj_name}
</Link>
<Link to={'/project/' + item.proj_id}>{item.proj_name}</Link>
</Table.Cell>
<Table.Cell>{item.updated_at}</Table.Cell>
<Table.Cell collapsing>{item.proj_share === 0 ? t("MAIN_TBL_PRIVATE") : t("MAIN_TBL_PUBLIC")}</Table.Cell>
<Table.Cell collapsing>{item.proj_share === 1 ? t("MAIN_TBL_PRIVATE") : t("MAIN_TBL_PUBLIC")}</Table.Cell>
<Table.Cell collapsing textAlign='center'>{item.user_name}</Table.Cell>
<Table.Cell collapsing textAlign='center'>{item.team_name}</Table.Cell>
<Table.Cell collapsing textAlign='right' className='fix-display'>
<NewProjectForm
className='icon-pointer'
......@@ -129,7 +128,7 @@ class HomepageProjectTable extends Component {
<Table celled striped color='blue' sortable>
<Table.Header>
<Table.Row>
<Table.HeaderCell colSpan={6}>
<Table.HeaderCell colSpan={numColumnsTable}>
<Input type='text' placeholder={t("BTN_SEARCH") + '...'} action>
<input
onChange={this.handleSearchValue.bind(this)}
......@@ -151,7 +150,7 @@ class HomepageProjectTable extends Component {
</Table.HeaderCell>
</Table.Row>
<Table.Row style={{'display': this.state.displayFilter ? 'table-row' : 'none'}}>
<Table.HeaderCell colSpan={6}>
<Table.HeaderCell colSpan={numColumnsTable}>
<List>
<List.Item>
<Radio label={t("FLT_PRIVATE")}
......@@ -165,12 +164,14 @@ class HomepageProjectTable extends Component {
onChange={this.handleRadioFilter.bind(this, 'team')}
/>
</List.Item>
<List.Item>
<Radio label={t("FLT_PUBLIC")}
checked={this.props.checkedRadioFilter === 'public'}
onChange={this.handleRadioFilter.bind(this, 'public')}
/>
</List.Item>
{
// <List.Item>
// <Radio label={t("FLT_PUBLIC")}
// checked={this.props.checkedRadioFilter === 'public'}
// onChange={this.handleRadioFilter.bind(this, 'public')}
// />
// </List.Item>
}
</List>
</Table.HeaderCell>
</Table.Row>
......@@ -200,6 +201,12 @@ class HomepageProjectTable extends Component {
{t("MAIN_TBL_SHARE")}
</Table.HeaderCell>
<Table.HeaderCell>{t("MAIN_TBL_USEROWN")}</Table.HeaderCell>
<Table.HeaderCell
sorted={this.state.column === 'team_name' ? this.state.direction : null}
onClick={this.handleSort.bind(this, 'team_name')}
>
{t("MAIN_TBL_TEAMOWN")}
</Table.HeaderCell>
<Table.HeaderCell>{t("MAIN_TBL_ACTIONS")}</Table.HeaderCell>
</Table.Row>
</Table.Header>
......@@ -210,9 +217,9 @@ class HomepageProjectTable extends Component {
<Table.Footer>
<Table.Row>
<Table.HeaderCell colSpan='6'>
<Table.HeaderCell colSpan={numColumnsTable}>
<Pagination
defaultActivePage={this.state.currentPage}
defaultActivePage={this.state.page}
totalPages={this.state.totalPages}
onPageChange={this.changePageProject.bind(this)}
/>
......@@ -232,6 +239,7 @@ HomepageProjectTable.propTypes = {
resetSearch: PropTypes.func.isRequired,
project: PropTypes.array.isRequired,
total: PropTypes.number.isRequired,
page: PropTypes.number.isRequired,
user: PropTypes.object.isRequired,
optionsLayouts: PropTypes.array,
optionsProfiles: PropTypes.array,
......
......@@ -62,7 +62,6 @@ class BasicProject extends Component {
}
componentDidMount() {
let self = this
let query
if (this.state.mode === true) {
// Block the chapter
......@@ -93,16 +92,15 @@ class BasicProject extends Component {
`
this.props.fetchChapterContent(query, null, null, null, true)
// TODO: Rivedere questa parte per eliminare il timeout
setTimeout(() => {
let elem = document.getElementById('navbar')
let navbarHeight = elem.offsetHeight + 10
let style = { 'top': navbarHeight + 'px'}
self.setState({cardStyle: style, SavedCardStyle: style})
}, 50)
var navbarInterval = setInterval(() => {
if (!this.props.chapterHasErrored && !this.props.chapterIsLoading) {
// Setta la distanza della card dai menù
let elem = document.getElementById('navbar')
let navbarHeight = elem.offsetHeight + 10
let style = { 'top': navbarHeight + 'px'}
this.setState({cardStyle: style})
// Setta la navbar card di default
this.props.setNavbarCard(0)
clearInterval(navbarInterval)
}
......@@ -127,7 +125,7 @@ class BasicProject extends Component {
// event.returnValue = "Confirm to exit";
// })
if (this.props.chapterHasErrored || this.props.chapterDataIsLoading) {
if (this.props.chapterHasErrored || this.props.chapterIsLoading) {
return (
<Dimmer
active={!this.props.chapterDataIsLoading}
......
......@@ -13,6 +13,7 @@ import { styleDataFetchData } from '../store/actions/StyleFetchActions'
import { symstyleDataFetchData } from '../store/actions/SymStyleFetchActions'
import { userTeamDataFetchData } from '../store/actions/UserTeamFetchActions'
import { userToHome } from '../store/actions/UserActions'
import { filterSetValue } from '../store/actions/FilterActions'
class InitProgress extends Component {
constructor(props) {
......@@ -32,6 +33,21 @@ class InitProgress extends Component {
}
}
componentDidMount() {
// Setto il team di default
let indexTeam = this.props.team.findIndex(x => x.user_id === this.props.user.id)
this.props.changeFilter(this.props.team[indexTeam].team_id)
this.props.userToHome(false)
this.props.fetchUserTeam()
this.props.fetchProject()
this.props.fetchProfile()
this.props.fetchLayout()
this.props.fetchClass()
this.props.fetchStyle()
this.props.fetchSymStyle()
}
componentDidUpdate(prevProps) {
if (this.props.user.length !== 0 && this.state.listProgress.every((x => x.loading === false))) {
if (this.props.team.length > 1) {
......@@ -82,17 +98,6 @@ class InitProgress extends Component {
}
}
componentDidMount() {
this.props.userToHome(false)
this.props.fetchUserTeam()
this.props.fetchProject()
this.props.fetchProfile()
this.props.fetchLayout()
this.props.fetchClass()
this.props.fetchStyle()
this.props.fetchSymStyle()
}
updateProgressBar(data, index, progressValue) {
data[index].iconName = 'check'
data[index].loading = false
......@@ -146,6 +151,7 @@ const mapDispatchToProps = (dispatch) => {
fetchStyle: (query) => dispatch(styleDataFetchData(query)),
fetchSymStyle: (query) => dispatch(symstyleDataFetchData(query)),
fetchUserTeam: (query) => dispatch(userTeamDataFetchData(query)),
changeFilter: (value) => dispatch(filterSetValue(value)),
}
}
......
import React, { Component } from 'react'
import { Segment, Grid, Button, Message, Header, Icon } from 'semantic-ui-react'
import { withRouter } from 'react-router-dom'
import { connect } from 'react-redux'
import { translate, Trans } from 'react-i18next'
import { connect } from 'react-redux'
import { filterSetValue } from '../store/actions/FilterActions'
import TeamSwitcher from './switcher/TeamSwitcher'
......
......@@ -2,7 +2,7 @@ import React, { Component } from 'react'
import { Icon, Popup, Menu } from 'semantic-ui-react'
import { translate, Trans } from 'react-i18next'
import UploadSymbol from '../../UploadSymbol'
import UploadSymbol from '../UploadSymbol'
import { connect } from 'react-redux'
import { toggleVisibilityImgAlt, mergeCard, unlinkCard, blockCard, copyCard, searchLemma, addBeforeAfterCard, deleteCard } from '../../store/actions/CardUIActions'
......@@ -60,6 +60,7 @@ class BasicProjectNavBar extends Component {
size='large'
className="icon-pointer"
onClick={() => {this.props.toggleVisibilityImgAlt()}}
disabled={this.props.navbarCard.imgAlt.length <= 1 ? true : false}
/>}
content={t("POPUP_SHOW")}
/>
......@@ -90,6 +91,7 @@ class BasicProjectNavBar extends Component {
size='large'
onClick={() => {this.props.searchLemma()}}
className="icon-pointer"
disabled={this.props.navbarCard.lock === 'lock' ? true : false}
/>
}
content={t("POPUP_SEARCH")}
......
......@@ -167,7 +167,7 @@ class CardUI extends Component {
let styles = {}
if (this.props.Style && this.props.borderCard) {
styles = Object.assign({}, this.props.Style, this.state.borderCard[item.codClass]);
styles = Object.assign({}, this.props.Style, this.state.borderCard[item.codClass])
}
else if (this.props.Style) {
styles = this.props.Style
......@@ -175,6 +175,7 @@ class CardUI extends Component {
else if (this.props.borderCard) {
styles = this.state.borderCard[item.codClass]
}
let cardInput = <Card.Content>
<Input
size= {this.props.sizeInput}
......@@ -239,7 +240,7 @@ class CardUI extends Component {
}
}
return(
<Card.Group key={index}>
<Card.Group key={index} className='cardLine'>
{cardPerRow}
</Card.Group>
)
......
......@@ -167,24 +167,30 @@ class NewProjectForm extends Component {
// 'line_spacing_right': lineSpacingArray[7] || lineSpacingArray[3],
}
this.dispatchUpdateProject(this.props.data.proj_id, this.state.newProjectTitle, this.state.newProjectNote,
this.state.share)
this.state.share, localLayout)
this.setState({errorMessage: {hidden: true, text: this.props.t("PRJ_FRM_ERROR_CONTENT")}, modalVisible: !this.state.modalVisible})
}
}
// Aggiorna un progetto preesistente
dispatchUpdateProject(id, title, notes, share) {
dispatchUpdateProject(id, title, notes, share, layout) {
// Parse all Variables
let escapedNotes = escapeQuotes(notes)
let escapedTitle = escapeQuotes(title)
let proj_share = share === false ? 0 : 1
let proj_layout
if (typeof layout.layout_margins === 'string') {
layout.layout_margins = JSON.parse(layout.layout_margins)
}
proj_layout = escapeQuotes(layout)
let query = `
mutation updateProject {
updateCaaProject(id: ${id},
proj_name: "${escapedTitle}",
proj_share: ${proj_share},
proj_note: "${escapedNotes}"){
proj_note: "${escapedNotes}",
proj_layout: "${proj_layout}"){
id
}
}
......@@ -385,7 +391,7 @@ class NewProjectForm extends Component {
</Form.Group>
<Form.Field>
<label>{t("MAIN_FRM_SHARE")}</label>
<Checkbox label={t("MAIN_FRM_PUBLIC")}
<Checkbox label={t("MAIN_FRM_PRIVATE")}
checked={this.state.share}
onClick={this.handleCheckboxChange.bind(this)}
/>
......
......@@ -11,9 +11,9 @@ import HomepageProjectTable from '../../components/homepage/HomepageProjectTable
import HomepageLayoutTable from '../../components/homepage/HomepageLayoutTable'
import { connect } from 'react-redux'
import { projectDataFetchData, projectDataDeleteData } from '../../store/actions/ProjectFetchActions'
import { projectDataFetchData, projectDataDeleteChapterData } from '../../store/actions/ProjectFetchActions'
import { profileDataDeleteData } from '../../store/actions/ProfileFetchActions'
import { dispatchFilter } from '../../store/actions/FilterActions'
import { dispatchFilter, setPaginationSelectedPage } from '../../store/actions/FilterActions'
class RootComponent extends Component {
constructor(props) {
......@@ -29,6 +29,7 @@ class RootComponent extends Component {
optionsLayouts: [{}],
fetchFinished: false,
radioFilter: props.filterMode,
page: props.projectPage,
}
}
......@@ -95,7 +96,7 @@ class RootComponent extends Component {
// Elimina il progetto e tutti i capitoli ad esso correlati
deleteProject() {
this.props.deleteCurrentProject(this.state.deleteProjectId)
this.props.deleteCurrentProject(this.state.deleteProjectId, true)
}
// Elimina il profilo
......@@ -106,6 +107,7 @@ class RootComponent extends Component {
// Change page on Project Table
changePageProject(activePage) {
this.setState({page: activePage.activePage}, () => {
this.props.changePage(this.state.page)
this.props.fetchProject(null, 15, this.state.page)
})
}
......@@ -169,6 +171,7 @@ class RootComponent extends Component {
searchProject={this.searchProject.bind(this)}
resetSearch={this.resetSearch.bind(this)}
total={this.props.projectTotal}
page={this.state.page}
project={this.props.project}
user={this.props.user}
optionsLayouts={this.state.optionsLayouts}
......@@ -222,6 +225,7 @@ const mapStateToProps = (state) => {
user: state.user,
project: state.projectData,
projectTotal: state.projectDataTotal,
projectPage: state.projectPaginationPage,
profile: state.profileData,
layout: state.layoutData,
userTeam: state.userTeamData,
......@@ -232,9 +236,10 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
fetchProject: (query, limit, page, searchValue) => dispatch(projectDataFetchData(query, limit, page, searchValue)),
deleteCurrentProject: (id) => dispatch(projectDataDeleteData(id)),
deleteCurrentProject: (id, deleteProject) => dispatch(projectDataDeleteChapterData(id, deleteProject)),
deleteCurrentProfile: (id) => dispatch(profileDataDeleteData(id)),
changeFilter: (mode, value) => dispatch(dispatchFilter(mode, value))
changeFilter: (mode, value) => dispatch(dispatchFilter(mode, value)),
changePage: (value) => dispatch(setPaginationSelectedPage(value)),
}
}
......
import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import { Button, Menu, Card } from 'semantic-ui-react'
import { Button, Menu, Card, Dimmer, Loader } from 'semantic-ui-react'
import { translate, Trans } from 'react-i18next'
import { withRouter } from 'react-router-dom'
......@@ -74,7 +74,7 @@ class Project extends Component {
this.props.updateChapter(query, this.props.match.params.projectid)
}
// redirect to homepage and clean the chapter list data\
// redirect to homepage and clean the chapter list data
redirectProject() {
this.props.resetProject([])
this.props.history.push('/home')
......@@ -84,6 +84,17 @@ class Project extends Component {
render() {
const { t, i18n } = this.props
if (this.props.chaptHasErrored || this.props.chaptIsLoading) {
return (
<Dimmer
active={this.props.chaptIsLoading}
page
>
<Loader active inline='centered' size='massive' />
</Dimmer>
)
}
let localChapters = this.props.chapters
localChapters = localChapters.map((item, index) => {
return (
......@@ -143,6 +154,8 @@ const mapStateToProps = (state) => {
user: state.user,
chapters: state.chapterData,
project: state.projectData,
chaptIsLoading: state.chapterDataIsLoading,
chaptHasErrored: state.chapterDataHasErrored,
}
}
......
......@@ -561,20 +561,19 @@ class LayoutExport extends Component {
'pagesNumber': this.state.pagesNumber}}
localProject.chapt_typo = JSON.stringify(localProject.chapt_typo)
let url = window.env.RestApiCard
let self = this
let data = JSON.stringify(localProject)
let xhr = new XMLHttpRequest()
this.setState({loadingButton: true})
xhr.addEventListener("readystatechange", () => {
if (this.readyState === 4) {
if (this.status === 200) {
self.setState({saveMessage: false, loadingButton: false, hasTypoSaved: true})
self.sleep(1000).then(() => {
self.setState({saveMessage: true})
});
if (xhr.readyState === 4) {
if (xhr.status === 200) {
this.setState({saveMessage: false, loadingButton: false, hasTypoSaved: true})
this.sleep(1000).then(() => {
this.setState({saveMessage: true})
});
}
}
}
})
xhr.open("POST", url)
xhr.setRequestHeader("content-type", "application/json")
......
......@@ -12,6 +12,11 @@ import i18n from './i18n'
const store = configureStore()
// disable REACT DEVTOOLS
if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
window.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers = {}
}
ReactDOM.render(
<Provider store={store}>
<I18nextProvider i18n={ i18n }>
......
......@@ -45,11 +45,11 @@ export function chapterDataFetchData(fetchQuery = null, limit = 100, page = 1, i
}, 0)
} else {
contentData = [{id: 0,
lemma: 'React',
lemmaPrevious: 'React',
img: 'react.png',
lemma: 'simcaa',
lemmaPrevious: 'simcaa',
img: 'simcaa.png',
sinonimi: 0,
imgAlt: [{voice_human: 'react',voice_master: 'react', img: 'react.png'}],
imgAlt: [{voice_human: 'simcaa',voice_master: 'simcaa', img: 'simcaa.png'}],
lock: 'unlock',
codClass: 'Altro',
complex: '0',
......
import { FILTER_PROJECT_VALUE, FILTER_PROJECT_MODE } from '../constants'
import { FILTER_PROJECT_VALUE, FILTER_PROJECT_MODE, FILTER_PROJECT_PAGINATION_PAGE } from '../constants'
export function dispatchFilter(mode = null, value = null) {
return (dispatch) => {
......@@ -24,3 +24,10 @@ export function filterSetValue(value = 1) {
value
}
}
export function setPaginationSelectedPage(value = 1) {
return {
type: FILTER_PROJECT_PAGINATION_PAGE,
value
}
}
......@@ -20,8 +20,7 @@ export function projectDataFetchData(fetchQuery = null, limit = 15, page = 1, se
variablesQuery += ' team_id: ' + state.filterValue
break;
case 'public':
variablesQuery += ' proj_share: 1'
variablesQuery += ' proj_share: 0'
break;
default:
}
......@@ -112,13 +111,13 @@ export function projectDataUpdateData(mutationQuery) {
}
}
export function projectDataDeleteData(id) {
export function projectDataDeleteChapterData(id, deleteProject = false) {
return (dispatch, getState) => {
dispatch(projectDataIsLoading(true))
let query = `
query chaptersToDelete {
chapters(caa_project_id: ${id}) {
chapters(caa_project_id: ${id}, limit: 100) {
data {
id
}
......@@ -131,60 +130,59 @@ export function projectDataDeleteData(id) {
dispatch(projectDataIsLoading(false))
dispatch(projectDataHasErrored(true))
} else {
let idList = ''
for (let i = 0; i < data.data.chapters.data.length; i++) {
idList += data.data.chapters.data[i].id + ' '
}
query = `
mutation chapterToDelete {
deleteCaaChapter(idToDelete: "${idList}") {
id
if (data.data.chapters.data.length > 0) {
let idList = ''
for (let i = 0; i < data.data.chapters.data.length; i++) {
idList += data.data.chapters.data[i].id + ' '
}
}`
apolloFetch({ query })
.then((data) => {
if (data.data.deleteCaaChapter.error) {
dispatch(projectDataIsLoading(false))
dispatch(projectDataHasErrored(true))
} else {
query = `
mutation deleteProject {
deleteCaaProject(id: ${id}) {
id
}
query = `
mutation chapterToDelete {
deleteCaaChapter(idToDelete: "${idList}") {
id
}
`
apolloFetch({ query })
.then((data) => {
if (data.data.deleteCaaProject.error) {
dispatch(projectDataIsLoading(false))
dispatch(projectDataHasErrored(true))
} else {
dispatch(projectDataHasErrored(false))
dispatch(projectDataFetchData())
}
})
.catch((error) => {
}`
apolloFetch({ query })
.then((data) => {
if (data.data.deleteCaaChapter.error) {
dispatch(projectDataIsLoading(false))
dispatch(projectDataHasErrored(true))
})
} else {
dispatch(projectDataDeleteData(id))
}
})
.catch((error) => {
dispatch(projectDataIsLoading(false))
dispatch(projectDataHasErrored(true))
})
} else {
if (deleteProject === true) {
dispatch(projectDataDeleteData(id))
}
})
.catch((error) => {
dispatch(projectDataIsLoading(false))
dispatch(projectDataHasErrored(true))
})
}
}
})
.catch((error) => {
dispatch(projectDataIsLoading(false))
dispatch(projectDataHasErrored(true))
})
}
}
export function projectDataDeleteData(id) {
return (dispatch, getState) => {
dispatch(projectDataIsLoading(true))
let query = `
mutation deleteProject {
deleteCaaProject(id: ${id}) {
id
}
}
`
apolloFetch({ query })
.then((data) => {
dispatch(projectDataIsLoading(false))
if (data.data.updateCaaProject.error) {
if (data.data.deleteCaaProject.error) {
dispatch(projectDataIsLoading(false))
dispatch(projectDataHasErrored(true))
} else {
dispatch(projectDataHasErrored(false))
......
......@@ -48,6 +48,7 @@ export const FETCH_USERTEAM_DATA_ERROR = 'FETCH_USERTEAM_DATA_ERROR'
// Filter constants
export const FILTER_PROJECT_MODE = 'FILTER_PROJECT_MODE'
export const FILTER_PROJECT_VALUE = 'FILTER_PROJECT_VALUE'
export const FILTER_PROJECT_PAGINATION_PAGE = 'FILTER_PROJECT_PAGINATION_PAGE'
// Chapter constants
export const FETCH_CHAPTER_DATA = 'FETCH_CHAPTER_DATA'
......
......@@ -83,14 +83,18 @@ export function checkWithImage(data) {
export function setLineSpacing(margins) {
// TODO: RIVEDERE PER TOGLIERE IL TIMEOUT QUANDO SI AGGIUNGE/ELIMINA UNA CARD
setTimeout(() => {
// set linespacing for every cards
let style = document.getElementsByClassName("cardUI")
let updateVarMargins = margins.line_spacing_top/2 + 'px ' +
// margins.line_spacing_right + 'px '
// margins.line_spacing_bottom + 'px ' +
margins.line_spacing_left/2 + 'px '
for (var i = 0; i < style.length; i++) {
style[i].style.setProperty("--margin-card", updateVarMargins)
}
let updateVarMargins = margins.line_spacing_top/2 + 'px ' + margins.line_spacing_left/2 + 'px '
Object.values(style).map(item => {
item.style.setProperty("--margin-card", updateVarMargins)
})
// set linespacing for every line
let divLineStyle = document.getElementsByClassName("cardLine")
Object.values(divLineStyle).map(item => {
item.style.setProperty("--margin-card", margins.line_spacing_left + 'px ')
})
}, 50)
}
......
import { FILTER_PROJECT_MODE, FILTER_PROJECT_VALUE } from '../constants'
import { FILTER_PROJECT_MODE, FILTER_PROJECT_VALUE, FILTER_PROJECT_PAGINATION_PAGE } from '../constants'
export function filterMode(state = 'private', action) {
switch (action.type) {
......@@ -19,3 +19,12 @@ export function filterValue(state = 1, action) {
return state
}
}
export function projectPaginationPage(state = 1, action) {
switch (action.type) {
case FILTER_PROJECT_PAGINATION_PAGE:
return action.value
default:
return state
}
}
......@@ -7,7 +7,7 @@ import { layoutData, layoutDataHasErrored, layoutDataIsLoading } from './LayoutF
import { classData, classDataHasErrored, classDataIsLoading } from './ClassFetchReducers'
import { styleData, styleDataHasErrored, styleDataIsLoading } from './StyleFetchReducers'
import { symstyleData, symstyleDataHasErrored, symstyleDataIsLoading } from './SymStyleFetchReducers'
import { filterMode, filterValue } from './FilterReducers'
import { filterMode, filterValue, projectPaginationPage } from './FilterReducers'
import { userTeamData, userTeamDataHasErrored, userTeamDataIsLoading } from './UserTeamFetchReducers'
import { chapterData, chapterContentData, chapterTypoData, chapterDataHasErrored, chapterDataIsLoading } from './ChapterFetchReducers'
import { cardUINavbarCard, toggleVisibilityImgAlt, selectedProjectID, CardUIsaveIsCompleted, CardUIsaveHasErrored, CardUIsaveIsLoading } from './CardUIReducers'
......@@ -49,6 +49,7 @@ export default combineReducers({
filterMode,
filterValue,
projectPaginationPage,
userTeamData,
userTeamDataHasErrored,
......