Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: unstructuredstudio/zubhub
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5d0c723b159353ca2f2fbc5e3a1b11ee3c62db45
Choose a base ref
..
head repository: unstructuredstudio/zubhub
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2b81fefcd69c299de2c37879a1cafab27e79c30a
Choose a head ref
4 changes: 2 additions & 2 deletions zubhub_frontend/zubhub/public/locales/en/translation.json
Original file line number Diff line number Diff line change
@@ -649,7 +649,7 @@
},
"activityLog": {
"activity": "Activity Log",
"addActivityLog": "Seems like there isn't any activity on your account yet! Get involved to see activity logs!"
"addActivityLog": "Seems like there isn't any activity on your account yet! Get involved to see activity logs!"
},
"team": "Team",
"createteam": "Create Team",
@@ -1197,4 +1197,4 @@
"buttonLabel": "Get Started"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@ const styles = theme => ({
tabs: {
margin: '2em 0',
[theme.breakpoints.up('900')]: {
paddingRight: '1em'
}
paddingRight: '1em',
},
},
tab: {
textTransform: 'none',
fontSize: '1.2em',
fontWeight: 600
fontWeight: 600,
},
activityListContainer: {
padding: '4em 0',
@@ -22,7 +22,7 @@ const styles = theme => ({
},
},
activitiesContainer: {
marginTop: 0
marginTop: 0,
},
activityBoxContainer: {
padding: '5vh 10px',
208 changes: 91 additions & 117 deletions zubhub_frontend/zubhub/src/store/actions/activityActions.js
Original file line number Diff line number Diff line change
@@ -2,35 +2,32 @@ import { toast } from 'react-toastify';

import API from '../../api/api';
import * as at from '../actionTypes';
let ActivityAPI = new API();

export const setActivities = activities => {
return dispatch => {
dispatch({
type: at.SET_ACTIVITIES,
payload: { all_activities: activities },
});
};
const ActivityAPI = new API();

export const setActivities = activities => dispatch => {
dispatch({
type: at.SET_ACTIVITIES,
payload: { all_activities: activities },
});
};

export const setActivity = activity => {
return dispatch => {
dispatch({
type: at.SET_ACTIVITY,
payload: { activity: activity },
});
};
export const setActivity = activity => dispatch => {
dispatch({
type: at.SET_ACTIVITY,
payload: { activity },
});
};

export const getMyActivities = ({ t, token }) => {
console.log('getMyActivities', token);
return async dispatch => {
return ActivityAPI.getMyActivities(token)
return async dispatch =>
ActivityAPI.getMyActivities(token)
.then(res => {
console.log('result', res);

if (res.status >= 200 && res.status < 300) {
let response = res.json();
const response = res.json();
response.then(all => {
console.log('all', all);
dispatch({
@@ -40,31 +37,26 @@ export const getMyActivities = ({ t, token }) => {
},
});
});
} else if (res.status === 403 && res.statusText === 'Forbidden') {
toast.warning(t('activityDetails.activity.delete.dialog.forbidden'));
} else {
if (res.status === 403 && res.statusText === 'Forbidden') {
toast.warning(
t('activityDetails.activity.delete.dialog.forbidden'),
);
} else {
toast.warning(t('activities.errors.dialog.serverError'));
}
toast.warning(t('activities.errors.dialog.serverError'));
}
})
.catch(error => {
.catch(() => {
toast.warning(t('activities.errors.dialog.serverError'));
});
};
};

export const getUnPublishedActivities = ({ t, token }) => {
console.log('getUnPublishedActivities', token);
return async dispatch => {
return ActivityAPI.getUnPublishedActivities(token)
return async dispatch =>
ActivityAPI.getUnPublishedActivities(token)
.then(res => {
console.log('result', res);

if (res.status >= 200 && res.status < 300) {
let response = res.json();
const response = res.json();
response.then(all => {
console.log('all', all);
dispatch({
@@ -74,109 +66,91 @@ export const getUnPublishedActivities = ({ t, token }) => {
},
});
});
} else if (res.status === 403 && res.statusText === 'Forbidden') {
toast.warning(t('activityDetails.activity.delete.dialog.forbidden'));
} else {
if (res.status === 403 && res.statusText === 'Forbidden') {
toast.warning(
t('activityDetails.activity.delete.dialog.forbidden'),
);
} else {
toast.warning(t('activities.errors.dialog.serverError'));
}
toast.warning(t('activities.errors.dialog.serverError'));
}
})
.catch(error => {
.catch(() => {
toast.warning(t('activities.errors.dialog.serverError'));
});
};
};

export const getActivities = t => {
return async dispatch => {
return ActivityAPI.getActivities()
.then(res => {
if (res.status >= 200 && res.status < 300) {
let response = res.json();
response.then(all => {
dispatch({
type: at.SET_ACTIVITIES,
payload: {
all_activities: all,
},
});
export const getActivities = t => async dispatch =>
ActivityAPI.getActivities()
.then(res => {
if (res.status >= 200 && res.status < 300) {
const response = res.json();
response.then(all => {
dispatch({
type: at.SET_ACTIVITIES,
payload: {
all_activities: all,
},
});
} else {
if (res.status === 403 && res.statusText === 'Forbidden') {
toast.warning(
t('activityDetails.activity.delete.dialog.forbidden'),
);
} else {
toast.warning(t('activities.errors.dialog.serverError'));
}
}
})
.catch(error => {
toast.warning(t('activities.errors.dialog.serverError'));
});
};
};

export const activityCountView = args => {
return async dispatch => {
try {
const result = await ActivityAPI.activityToggleSave(args);
dispatch({
type: at.SET_ACTIVITY,
payload: { activity: result },
});
return { loading: false };
} catch (error) {
if (error.message.startsWith('Unexpected')) {
toast.warning(args.t('projects.errors.unexpected'));
});
} else if (res.status === 403 && res.statusText === 'Forbidden') {
toast.warning(t('activityDetails.activity.delete.dialog.forbidden'));
} else {
toast.warning(error.message);
toast.warning(t('activities.errors.dialog.serverError'));
}
return { loading: false };
})
.catch(() => {
toast.warning(t('activities.errors.dialog.serverError'));
});

export const activityCountView = args => async dispatch => {
try {
const result = await ActivityAPI.activityToggleSave(args);
dispatch({
type: at.SET_ACTIVITY,
payload: { activity: result },
});
return { loading: false };
} catch (error) {
if (error.message.startsWith('Unexpected')) {
toast.warning(args.t('projects.errors.unexpected'));
} else {
toast.warning(error.message);
}
};
return { loading: false };
}
};

export const activityToggleSave = args => {
return async dispatch => {
try {
const result = await ActivityAPI.activityToggleSave(args);
dispatch({
type: at.SET_ACTIVITY,
payload: { activity: result },
});
return { loading: false };
} catch (error) {
if (error.message.startsWith('Unexpected')) {
toast.warning(args.t('projects.errors.unexpected'));
} else {
toast.warning(error.message);
}
return { loading: false };
export const activityToggleSave = args => async dispatch => {
try {
const result = await ActivityAPI.activityToggleSave(args);
dispatch({
type: at.SET_ACTIVITY,
payload: { activity: result },
});
return { loading: false };
} catch (error) {
if (error.message.startsWith('Unexpected')) {
toast.warning(args.t('projects.errors.unexpected'));
} else {
toast.warning(error.message);
}
};
return { loading: false };
}
};

export const activityTogglePublish = args => {
return async dispatch => {
try {
const result = await ActivityAPI.activityTogglePublish(args);
export const activityTogglePublish = args => async dispatch => {
try {
const result = await ActivityAPI.activityTogglePublish(args);

dispatch({
type: at.SET_ACTIVITY,
payload: { activity: result },
});
return result;
} catch (error) {
if (error.message.startsWith('Unexpected')) {
toast.warning(args.t('projects.errors.unexpected'));
} else {
toast.warning(error.message);
}
return { error: error };
dispatch({
type: at.SET_ACTIVITY,
payload: { activity: result },
});
return result;
} catch (error) {
if (error.message.startsWith('Unexpected')) {
toast.warning(args.t('projects.errors.unexpected'));
} else {
toast.warning(error.message);
}
};
return { error };
}
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as at from '../actionTypes';

const default_state = {
all_activities: [],
published: [],
Loading