Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 901280363e | |||
| 6612f91047 | |||
| 5e7fabe1ce | |||
| e05aadd5c3 | |||
| 567a282dcf | |||
| 3eb5f6852f | |||
| 7ddab7d95c |
@@ -1,4 +1,3 @@
|
||||
|
||||
/node_modules/
|
||||
.next/
|
||||
.env
|
||||
|
||||
+1
-1
@@ -14,5 +14,5 @@ RUN apk add --no-cache bash
|
||||
|
||||
RUN apk add --no-cache yarn
|
||||
|
||||
CMD cd /home/app/nextjs && yarn cache dir && yarn cache clean && yarn build && pm2 startOrReload ecosystem.config.js --env production --no-daemon
|
||||
CMD cd /home/app/nextjs && yarn cache dir && yarn cache clean && yarn install && yarn build && pm2 startOrReload ecosystem.config.js --env production --no-daemon
|
||||
|
||||
|
||||
@@ -39,6 +39,18 @@ Try to name without too much precision
|
||||
[components/organisms] General components
|
||||
[components/templates] Layouts components
|
||||
|
||||
## MEP
|
||||
|
||||
=================================
|
||||
Mise en PRE-production de l’application PWA
|
||||
=================================
|
||||
Aller dans la preproduction et git pull dans le répertoire /app (pas www)
|
||||
Possibilité de devoir git stash
|
||||
Attention de bien avoir le .env
|
||||
Restart docker preproduction (sudo make ENV=preprod docker-restart)
|
||||
sudo docker exec -it frontnginx.nginx bash
|
||||
nginx -t && nginx -s reload
|
||||
|
||||
## Test
|
||||
### Cypress
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ import { withStyles } from '@material-ui/core/styles'
|
||||
import IconButton from '@material-ui/core/IconButton';
|
||||
import CloseIcon from '@material-ui/icons/Close';
|
||||
|
||||
import Link from 'next/link'
|
||||
|
||||
const styles = theme => ({
|
||||
close: {
|
||||
padding: theme.spacing.unit / 2,
|
||||
|
||||
@@ -35,7 +35,7 @@ class WebPush extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (swRegistration === null) {
|
||||
@@ -44,12 +44,12 @@ class WebPush extends Component {
|
||||
}
|
||||
|
||||
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||
console.log("isUserSubscribedToPush ::: " + nextProps.isUserSubscribedToPush);
|
||||
if (this.props.subscriveUserEnabled != nextProps.subscriveUserEnabled && nextProps.subscriveUserEnabled) {
|
||||
this.onSubscribeUser()
|
||||
}
|
||||
|
||||
if(!!nextProps.isUserSubscribedToPush){
|
||||
this.setState({on: true})
|
||||
if (!!nextProps.isUserSubscribedToPush) {
|
||||
this.setState({ on: true })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,99 +80,97 @@ class WebPush extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
onSubscribeUser = () => {
|
||||
if (swRegistration == null) {
|
||||
return
|
||||
onSubscribeUser = () => {
|
||||
if (swRegistration == null) {
|
||||
return
|
||||
}
|
||||
|
||||
swRegistration.pushManager.getSubscription()
|
||||
.then((subscription) => {
|
||||
var isSubscribed = !(subscription === null)
|
||||
if (isSubscribed) {
|
||||
this.onUpdateSubscriptionOnServer(subscription)
|
||||
} else {
|
||||
const applicationServerKey = urlB64ToUint8Array(applicationServerPublicKey)
|
||||
swRegistration.pushManager.subscribe({
|
||||
userVisibleOnly: true,
|
||||
applicationServerKey: applicationServerKey
|
||||
})
|
||||
.then((subscription) => {
|
||||
console.log('User is subscribed.')
|
||||
if (this.onUpdateSubscriptionOnServer) {
|
||||
this.onUpdateSubscriptionOnServer(subscription)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('Failed to subscribe the user: ', err)
|
||||
if (onSubscribeFailed) {
|
||||
this.onSubscriptionFailed(err)
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
swRegistration.pushManager.getSubscription()
|
||||
.then((subscription) => {
|
||||
var isSubscribed = !(subscription === null)
|
||||
if (isSubscribed) {
|
||||
this.onUpdateSubscriptionOnServer(subscription)
|
||||
} else {
|
||||
const applicationServerKey = urlB64ToUint8Array(applicationServerPublicKey)
|
||||
swRegistration.pushManager.subscribe({
|
||||
userVisibleOnly: true,
|
||||
applicationServerKey: applicationServerKey
|
||||
})
|
||||
.then((subscription) => {
|
||||
console.log('User is subscribed.')
|
||||
if (this.onUpdateSubscriptionOnServer) {
|
||||
this.onUpdateSubscriptionOnServer(subscription)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('Failed to subscribe the user: ', err)
|
||||
if (onSubscribeFailed) {
|
||||
this.onSubscriptionFailed(err)
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
onUnSubscribeUser = () => {
|
||||
swRegistration.pushManager.getSubscription()
|
||||
|
||||
onUnSubscribeUser = () => {
|
||||
swRegistration.pushManager.getSubscription()
|
||||
.then((subscription) => {
|
||||
if (subscription) {
|
||||
|
||||
.then((subscription) => {
|
||||
if (subscription) {
|
||||
return subscription.unsubscribe();
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
this.setState(({ on }) => ({ on: false })))
|
||||
//TODO: facultatif update DB
|
||||
// .then(() => {
|
||||
// return fetch(//, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json'
|
||||
// },
|
||||
// body: JSON.stringify(subscription)
|
||||
// })
|
||||
// .then((response) => {
|
||||
// if (!response.ok) {
|
||||
// throw new Error('Bad status code from server.');
|
||||
// }
|
||||
// ///TODO bind UI
|
||||
// return true;
|
||||
// })
|
||||
|
||||
return subscription.unsubscribe();
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
this.setState(({ on }) => ({ on: false })))
|
||||
//TODO: facultatif update DB
|
||||
// .then(() => {
|
||||
// return fetch(//, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json'
|
||||
// },
|
||||
// body: JSON.stringify(subscription)
|
||||
// })
|
||||
// .then((response) => {
|
||||
// if (!response.ok) {
|
||||
// throw new Error('Bad status code from server.');
|
||||
// }
|
||||
// ///TODO bind UI
|
||||
// return true;
|
||||
// })
|
||||
// })
|
||||
.catch((err) => {
|
||||
console.error('Failed to unsubscribe the user.', err);
|
||||
|
||||
// })
|
||||
.catch((err) => {
|
||||
console.error('Failed to unsubscribe the user.', err);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
onRegisterServiceWorker = () => {
|
||||
navigator.serviceWorker.register('/static/js/Edeclic-service-worker.js')
|
||||
.then(function (swReg) {
|
||||
console.info('Service Worker is registered', swReg);
|
||||
|
||||
onRegisterServiceWorker = () => {
|
||||
navigator.serviceWorker.register('/static/js/Edeclic-service-worker.js')
|
||||
.then(function (swReg) {
|
||||
console.info('Service Worker is registered', swReg);
|
||||
swRegistration = swReg;
|
||||
})
|
||||
}
|
||||
|
||||
swRegistration = swReg;
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
return (<WebPushContext.Provider
|
||||
value={{ on: this.state.on, toggleSubscription: this.toggleSubscription }}
|
||||
{...this.props}
|
||||
/>)
|
||||
}
|
||||
render() {
|
||||
return (<WebPushContext.Provider
|
||||
value={{ on: this.state.on, toggleSubscription: this.toggleSubscription }}
|
||||
{...this.props}
|
||||
/>)
|
||||
}
|
||||
}
|
||||
|
||||
WebPush.propTypes = {
|
||||
}
|
||||
|
||||
function mapStateToProps(state) {
|
||||
|
||||
|
||||
return {
|
||||
isUserSubscribedToPush: state.isUserSubscribedToPush
|
||||
};
|
||||
isUserSubscribedToPush: state.user.isUserSubscribedToPush
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, { subscribeUserToPushRequest })(WebPush);
|
||||
|
||||
@@ -35,6 +35,9 @@ import withWidth, { isWidthUp } from '@material-ui/core/withWidth'
|
||||
import Typography from '@material-ui/core/Typography';
|
||||
import { withRouter } from "next/router";
|
||||
import ActiveLink from "./../atoms/Activelink";
|
||||
import axios from 'axios';
|
||||
import setAuthorizationHeader from "../../data/setAuthorizationHeader";
|
||||
|
||||
const styles = theme => ({
|
||||
root: {
|
||||
width: '100%',
|
||||
@@ -288,6 +291,7 @@ const styles = theme => ({
|
||||
},
|
||||
},
|
||||
});
|
||||
let urlEnv;
|
||||
|
||||
class Header extends React.Component {
|
||||
state = {
|
||||
@@ -298,20 +302,32 @@ class Header extends React.Component {
|
||||
toggle: true
|
||||
};
|
||||
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
toggleDrawer = (side, open) => () => {
|
||||
this.setState({
|
||||
[side]: open,
|
||||
});
|
||||
};
|
||||
|
||||
onRedirectAccount = e => {
|
||||
urlEnv = (process.env.NODE_ENV !== 'production') ? '//localhost/app_dev.php' : process.env.SERVER_URL;
|
||||
e.preventDefault();
|
||||
var redirectAccountUrl = urlEnv + "/api/talent?bearer=" + localStorage.getItem("ttJWT");
|
||||
window.open(redirectAccountUrl);
|
||||
}
|
||||
|
||||
toggle = () => this.setState(state => ({ toggle: !state.toggle }))
|
||||
|
||||
render() {
|
||||
const { classes } = this.props;
|
||||
|
||||
|
||||
|
||||
return (
|
||||
@@ -478,8 +494,8 @@ class Header extends React.Component {
|
||||
</ListItemText>
|
||||
</ListItem></a>
|
||||
</Link>
|
||||
<Link href="https://www.talentstube.com/login" >
|
||||
<a className={classes.lightMenuItem}><ListItem classes={{ root: classes.rootListItemIcon }}>
|
||||
<Link href="" >
|
||||
<a onClick={this.onRedirectAccount} className={classes.lightMenuItem}><ListItem classes={{ root: classes.rootListItemIcon }}>
|
||||
<AccountCircleIcon className={classes.icon} />
|
||||
<ListItemText primary='Mon compte'>
|
||||
</ListItemText>
|
||||
|
||||
@@ -30,7 +30,7 @@ const styles = theme => ({
|
||||
margin: '2vh 3vh 3vh 1vh',
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
margin: '1vh 0 1vh 0',
|
||||
height: '420px',
|
||||
height: '530px',
|
||||
},
|
||||
[theme.breakpoints.up('md')]: {
|
||||
height: '404px',
|
||||
|
||||
@@ -23,7 +23,7 @@ const styles = theme => ({
|
||||
paddingLeft: theme.spacing(1),
|
||||
paddingRight: theme.spacing(1),
|
||||
minHeight: '8vh',
|
||||
[theme.breakpoints.up('lg')]: {
|
||||
[theme.breakpoints.up('md')]: {
|
||||
minHeight: 'inherit',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<lastmod>2019-09-17</lastmod>
|
||||
</url>,<url>
|
||||
<loc>https://app.talentstube.com/Confidentialite</loc>
|
||||
<lastmod>2019-10-18</lastmod>
|
||||
<lastmod>2019-11-04</lastmod>
|
||||
</url>,<url>
|
||||
<loc>https://app.talentstube.com/Entreprises</loc>
|
||||
<lastmod>2019-09-17</lastmod>
|
||||
@@ -20,7 +20,7 @@
|
||||
<lastmod>2019-10-14</lastmod>
|
||||
</url>,<url>
|
||||
<loc>https://app.talentstube.com/MentionsLegales</loc>
|
||||
<lastmod>2019-10-18</lastmod>
|
||||
<lastmod>2019-11-04</lastmod>
|
||||
</url>,<url>
|
||||
<loc>https://app.talentstube.com/Offres</loc>
|
||||
<lastmod>2019-10-16</lastmod>
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"dev": "cross-env PORT=3000 node server.js",
|
||||
"build": "next build && yarn postExport && yarn copysw && yarn copySiteMap",
|
||||
"start": "cross-env PORT=8000 NODE_ENV=production node server.js",
|
||||
"startPreprod": "cross-env PORT=8000 NODE_ENV=preproduction node server.js",
|
||||
"pm2-prod": "yarn build && pm2 start --name 'next' -- start",
|
||||
"bs": "yarn build && yarn start",
|
||||
"test": "yarn cypress run",
|
||||
|
||||
@@ -57,7 +57,7 @@ const styles = theme => ({
|
||||
paddingBottom: theme.spacing(3),
|
||||
},
|
||||
[theme.breakpoints.up('md')]: {
|
||||
padding: theme.spacing(2, 20),
|
||||
padding: theme.spacing(2, 10),
|
||||
paddingBottom: theme.spacing(9),
|
||||
},
|
||||
[theme.breakpoints.up('lg')]: {
|
||||
|
||||
@@ -181,19 +181,20 @@ export function user(state = {
|
||||
return {
|
||||
...state,
|
||||
loading: false,
|
||||
pushSubscribed: true
|
||||
isUserSubscribedToPush: true
|
||||
}
|
||||
case SUBSCRIBE_USER_TO_PUSH_FAILURE:
|
||||
return {
|
||||
...state,
|
||||
loading: false,
|
||||
pushSubscribed: false,
|
||||
isUserSubscribedToPush: false,
|
||||
errors: action.err,
|
||||
}
|
||||
case FETCH_USER_SUBSCRIPTION_TO_PUSH_REQUEST:
|
||||
return {
|
||||
...state,
|
||||
loading: true,
|
||||
isUserSubscribedToPush: false,
|
||||
}
|
||||
case FETCH_USER_SUBSCRIPTION_TO_PUSH_SUCCESS:
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user