Skip to content

Commit

Permalink
Merge pull request #27 from EditVR/feat/FKED-4-scene-tilting
Browse files Browse the repository at this point in the history
FKED-4: Scene Tilting
  • Loading branch information
patrickocoffeyo authored Sep 28, 2018
2 parents 0907912 + 22901bb commit c61a775
Show file tree
Hide file tree
Showing 24 changed files with 679 additions and 114 deletions.
63 changes: 34 additions & 29 deletions src/actions/openExperience.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
OPEN_EXPERIENCE_COMPONENT_CREATE,
OPEN_EXPERIENCE_COMPONENT_DELETE,
OPEN_EXPERIENCE_COMPONENT_EDIT,
OPEN_EXPERIENCE_COMPONENT_FIELD_PRESAVE
OPEN_EXPERIENCE_COMPONENT_FIELD_PRESAVE,
OPEN_EXPERIENCE_SCENE_FIELD_PRESAVE
} from '../constants';
import {
openExperienceFetchForUser as getOpenExperienceForUser,
Expand Down Expand Up @@ -63,6 +64,8 @@ export function* openExperienceFetchForUser({ user, experienceSlug }) {
*
* @param {object} payload
* Payload for this saga action.
* @param {object} fields
* Fields values for the scene being created.
* @param {string} payload.title
* Title of this new scene.
* @param {string} payload.body
Expand All @@ -88,9 +91,7 @@ export function* openExperienceFetchForUser({ user, experienceSlug }) {
*/
export function* openExperienceSceneCreate({
user,
title,
body = '',
field_slug,
fields,
experience,
fileData,
fileName,
Expand All @@ -108,11 +109,8 @@ export function* openExperienceSceneCreate({
const skyField = file.filemime.startsWith('video')
? 'field_videosphere'
: 'field_photosphere';
const payload = {
title,
body,
field_slug
};

const payload = fields;
payload[skyField] = file.id;
const scene = yield call(sceneCreate, payload, user);

Expand All @@ -139,14 +137,8 @@ export function* openExperienceSceneCreate({
* Payload for this saga action.
* @param {string} payload.id
* ID of this scene.
* @param {string} payload.title
* Title of this new scene.
* @param {string} payload.body
* Body describing this new scene.
* @param {string} payload.field_slug
* URL slug describing this scene's URL segment.
* @param {string} payload.experience
* Object containing experience that this scene will be attached to.
* @param {object} payload.fields
* Object containing fields that should be updated.
* @param {object} payload.user
* Object containing user data.
* @param {object} payload.user.authentication
Expand All @@ -160,23 +152,14 @@ export function* openExperienceSceneCreate({
*/
export function* openExperienceSceneEdit({
id,
fields,
user,
title,
body = '',
field_slug,
successHandler = () => {}
}) {
yield* actionGenerator(
OPEN_EXPERIENCE_SCENE_EDIT,
function* openExperienceSceneEditHandler() {
const payload = {
id,
title,
body,
field_slug
};

const scene = yield call(sceneEdit, payload, user);
const scene = yield call(sceneEdit, id, fields, user);
yield put({
type: `${OPEN_EXPERIENCE_SCENE_EDIT}_SUCCESS`,
payload: scene
Expand Down Expand Up @@ -292,11 +275,28 @@ export function* openExperienceComponentFieldPresave(payload) {
});
}

/**
* Handles pre-saving a scene within the current openExperience.
*
* @param {object} payload - Payload for this saga action.
* @param {string} payload.sceneSlug - Slug of scene containing component.
* @param {string} payload.fieldName - Name of field who's value is changing.
* @param {string} payload.fieldValue - New value for {fieldName}.
*/
export function* openExperienceSceneFieldPresave(payload) {
yield put({
type: `${OPEN_EXPERIENCE_SCENE_FIELD_PRESAVE}_SUCCESS`,
payload
});
}

/**
* Dispatches an action that updates a component in the currently open scene.
*
* @param {object} payload
* Payload for this saga action.
* @param {object} payload.componentType
* Type of component that's being updated. (constant COMPONENT_TYPE_DIALOG).
* @param {string} payload.id
* ID of this component.
* @param {object} payload.fields
Expand All @@ -316,6 +316,7 @@ export function* openExperienceComponentFieldPresave(payload) {
*/
export function* openExperienceComponentEdit({
id,
componentType,
sceneSlug,
user,
fields,
Expand All @@ -329,7 +330,7 @@ export function* openExperienceComponentEdit({
...fields
};

const component = yield call(componentEdit, payload, user);
const component = yield call(componentEdit, componentType, payload, user);
yield put({
type: `${OPEN_EXPERIENCE_COMPONENT_EDIT}_SUCCESS`,
payload: {
Expand Down Expand Up @@ -358,5 +359,9 @@ export function* watchOpenExperienceActions() {
OPEN_EXPERIENCE_COMPONENT_FIELD_PRESAVE,
openExperienceComponentFieldPresave
);
yield takeLatest(
OPEN_EXPERIENCE_SCENE_FIELD_PRESAVE,
openExperienceSceneFieldPresave
);
yield takeLatest(OPEN_EXPERIENCE_COMPONENT_EDIT, openExperienceComponentEdit);
}
24 changes: 15 additions & 9 deletions src/actions/openExperience.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
OPEN_EXPERIENCE_COMPONENT_FIELD_PRESAVE,
OPEN_EXPERIENCE_COMPONENT_EDIT,
OPEN_EXPERIENCE_COMPONENT_CREATE,
COMPONENT_TYPE_DIALOG,
OPEN_EXPERIENCE_COMPONENT_DELETE
} from '../constants';
import {
Expand Down Expand Up @@ -91,9 +92,11 @@ describe('actions->openExperience', () => {
};

const payload = {
title,
body,
field_slug,
fields: {
title,
body,
field_slug
},
fileData,
fileName,
user,
Expand Down Expand Up @@ -154,9 +157,11 @@ describe('actions->openExperience', () => {

const payload = {
id,
title,
body,
field_slug,
fields: {
title,
body,
field_slug
},
user,
successHandler
};
Expand All @@ -173,8 +178,8 @@ describe('actions->openExperience', () => {
.next()
.call(
sceneEdit,
id,
{
id,
title,
body,
field_slug
Expand Down Expand Up @@ -288,7 +293,8 @@ describe('actions->openExperience', () => {
id,
successHandler,
user,
sceneSlug
sceneSlug,
componentType: COMPONENT_TYPE_DIALOG
})
.next()
.put(resetLoading())
Expand All @@ -299,7 +305,7 @@ describe('actions->openExperience', () => {
type: `${OPEN_EXPERIENCE_COMPONENT_EDIT}_LOADING`
})
.next()
.call(componentEdit, { ...fields, id }, user)
.call(componentEdit, COMPONENT_TYPE_DIALOG, { ...fields, id }, user)
.next()
.put({
type: `${OPEN_EXPERIENCE_COMPONENT_EDIT}_SUCCESS`,
Expand Down
10 changes: 8 additions & 2 deletions src/aframe/components/simpleLink.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
/* globals AFRAME */
import { equals } from 'ramda';

import { MODE_COMPONENT_PLACING } from '../../constants';
import {
MODE_COMPONENT_PLACING,
MODE_COMPONENT_SELECTING
} from '../../constants';
import connectRedux from '../utils/connectRedux';
import connectRouter from '../utils/connectRouter';
import navigateIcon from '../../assets/icons/navigate.jpg';
Expand Down Expand Up @@ -85,7 +88,10 @@ const simpleLinkContainer = {
active: true
};

if (editorMode === MODE_COMPONENT_PLACING) {
if (
editorMode === MODE_COMPONENT_PLACING ||
editorMode === MODE_COMPONENT_SELECTING
) {
simpleLink.active = false;
}

Expand Down
Loading

0 comments on commit c61a775

Please sign in to comment.