Skip to content

Commit

Permalink
move interviewer assets to public folder
Browse files Browse the repository at this point in the history
  • Loading branch information
jthrilly committed Nov 23, 2023
1 parent 42c8bed commit e7d13fe
Show file tree
Hide file tree
Showing 111 changed files with 34 additions and 84 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const config = {
],
ignorePatterns: ['node_modules', '*.stories.*', '*.test.*'],
rules: {
"@typescript-eslint/consistent-type-definitions": ['error', 'type'],
'no-process-env': 'error',
'no-console': 'error',
'@typescript-eslint/consistent-type-imports': [
Expand Down
2 changes: 1 addition & 1 deletion app/(interview)/interview/_components/InterviewShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { store } from '~/lib/interviewer/store';

const InterviewShell = () => {
return (
<motion.div className="grid grid-cols-2">
<motion.div className="grid h-[100vh] grid-cols-2">
<Provider store={store}>
<ProtocolScreen stageIndex={0} />
</Provider>
Expand Down
17 changes: 2 additions & 15 deletions lib/interviewer/components/StagesMenu/StagePreview.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import React from 'react';
import { connect } from 'react-redux';
import { withHandlers, compose } from 'recompose';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { motion } from 'framer-motion';
import { getCSSVariableAsNumber } from '@codaco/ui/src/utils/CSSVariables';
import timelineImages from '../../images/timeline';
import { get } from '../../utils/lodash-replacements';

const getTimelineImage = (type) => get(timelineImages, type, timelineImages.Default);
import Image from 'next/image';

const StagePreview = ({
item: {
Expand Down Expand Up @@ -55,11 +51,7 @@ const StagePreview = ({
key={id}
/>
<div className="stage-preview__image">
<img
src={getTimelineImage(type)}
alt="NameGenerator Interface"
title="NameGenerator Interface"
/>
<Image src={`/interviewer/images/timeline/stage--${type}.png`} alt="NameGenerator Interface" title="NameGenerator Interface" width={128} height={92} />
</div>
<div className="stage-preview__label">
{index + 1}
Expand All @@ -84,17 +76,12 @@ const stagePreviewHandlers = withHandlers({
},
});

const mapStateToProps = (state) => ({
currentStageIndex: currentStageIndex(state.router.location.pathname),
});

StagePreview.propTypes = {
item: PropTypes.object.isRequired,
active: PropTypes.bool.isRequired,
handleOpenStage: PropTypes.func.isRequired,
};

export default compose(
connect(mapStateToProps),
stagePreviewHandlers,
)(StagePreview);
13 changes: 3 additions & 10 deletions lib/interviewer/components/StagesMenu/StagesMenu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState, useRef, useLayoutEffect } from 'react';
import PropTypes from 'prop-types';
import { Search } from '@codaco/ui';
import { connect } from 'react-redux';
import { motion, AnimatePresence } from 'framer-motion';
Expand All @@ -8,15 +7,17 @@ import { Scroller } from '@codaco/ui';
import { getCSSVariableAsNumber, getCSSVariableAsString } from '@codaco/ui/src/utils/CSSVariables';
import { getProtocolStages } from '../../selectors/protocol';
import StagePreview from './StagePreview';
import { useInterview } from '~/providers/InterviewProvider';

const StagesMenu = (props) => {
const {
currentStageIndex,
stages,
setExpanded,
onStageSelect,
} = props;

const { currentStageIndex } = useInterview();

const [filter, setFilter] = useState('');

const scrollerRef = useRef(null);
Expand Down Expand Up @@ -211,21 +212,13 @@ const StagesMenu = (props) => {

function mapStateToProps(state) {
const currentStages = getProtocolStages(state);

const withIndex = currentStages.map((stage, index) => ({ ...stage, index }));

return {
stages: withIndex,
currentStageIndex: getCurrentStageIndex(state.router.location.pathname),
};
}

StagesMenu.propTypes = {
stages: PropTypes.array.isRequired,
currentStageIndex: PropTypes.number.isRequired,
setExpanded: PropTypes.func.isRequired,
};

export default compose(
connect(mapStateToProps, null),
)(StagesMenu);
20 changes: 10 additions & 10 deletions lib/interviewer/ducks/middleware/sound.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { playSound } from '../../utils/playSound';
import { actionTypes as networkActionTypes } from '../modules/network';
import createNodeSound from '../../interaction-sounds/create-node.wav';
import removeNodeSound from '../../interaction-sounds/discard.wav';
import toggleOnSound from '../../interaction-sounds/toggle-on.wav';
import toggleOffSound from '../../interaction-sounds/toggle-off.wav';
import openAppSound from '../../interaction-sounds/open-app.wav';
import addEdgeSound from '../../interaction-sounds/create-edge.wav';
import errorSound from '../../interaction-sounds/error.wav';
import edgeLinkingSound from '../../interaction-sounds/node-linking-mode.wav';
import finishSessionSound from '../../interaction-sounds/finish-interview.wav';
import dropSound from '../../interaction-sounds/drop-node.wav';
import createNodeSound from '~/public/interviewer/interaction-sounds/create-node.wav';
import removeNodeSound from '~/public/interviewer/interaction-sounds/discard.wav';
import toggleOnSound from '~/public/interviewer/interaction-sounds/toggle-on.wav';
import toggleOffSound from '~/public/interviewer/interaction-sounds/toggle-off.wav';
import openAppSound from '~/public/interviewer/interaction-sounds/open-app.wav';
import addEdgeSound from '~/public/interviewer/interaction-sounds/create-edge.wav';
import errorSound from '~/public/interviewer/interaction-sounds/error.wav';
import edgeLinkingSound from '~/public/interviewer/interaction-sounds/node-linking-mode.wav';
import finishSessionSound from '~/public/interviewer/interaction-sounds/finish-interview.wav';
import dropSound from '~/public/interviewer/interaction-sounds/drop-node.wav';
import { getNetworkEdges } from '../../selectors/network';

const sounds = {
Expand Down
35 changes: 0 additions & 35 deletions lib/interviewer/images/timeline/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion lib/interviewer/styles/components/_node-bin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@include transition-properties((opacity transform), var(--animation-easing), var(--animation-duration-fast));

background: transparent;
background-image: url('../../images/node-bin.svg');
background-image: url('/interviewer/images/node-bin.svg');
background-repeat: no-repeat;
background-size: contain;
width: 5rem;
Expand Down
4 changes: 2 additions & 2 deletions lib/interviewer/styles/containers/_searchable-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ $sort-height: 3.2rem;
color: var(--text);
border-radius: units.unit(3);
text-align: center;
background-image: url('../../images/roster-list-bg-cards.svg');
background-image: url('/interviewer/images/roster-list-bg-cards.svg');
background-repeat: no-repeat;
background-position: bottom;
background-size: 62%;
Expand All @@ -125,7 +125,7 @@ $sort-height: 3.2rem;

&::after {
content: '';
background-image: url('../../images/roster-list-character.svg');
background-image: url('/interviewer/images/roster-list-character.svg');
position: absolute;
bottom: -8.7rem;
left: 0;
Expand Down
23 changes: 14 additions & 9 deletions providers/InterviewProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@ import { parseAsInteger, useQueryState } from 'next-usequerystate';
const InterviewContext = createContext({
network: {} as NcNetwork,
networkHandlers: {
addNode: (_node: NcNode) => {},
addEdge: (_edge: NcEdge) => {},
updateNode: (_node: NcNode) => {},
updateEdge: (_edge: NcEdge) => {},
deleteNode: (_nodeId: string) => {},
deleteEdge: (_edgeId: string) => {},
addNode: (_node: NcNode) => null,
addEdge: (_edge: NcEdge) => null,
updateNode: (_node: NcNode) => null,
updateEdge: (_edge: NcEdge) => null,
deleteNode: (_nodeId: string) => null,
deleteEdge: (_edgeId: string) => null,
},
navigationHandlers: {
nextPage: () => {},
previousPage: () => {},
nextPage: () => null,
previousPage: () => null,
hasNextPage: false,
hasPreviousPage: false,
},
protocol: {} as Protocol,
interviewId: '',
stageConfig: {} as Stage,
currentStageIndex: 0,
});

function InterviewProvider({
Expand Down Expand Up @@ -58,7 +59,8 @@ function InterviewProvider({

const stages = protocol.stages;
const protocolStageCount = stages.length;
const stageConfig = stages[currentStage - 1] as Stage;
const currentStageIndex = currentStage - 1;
const stageConfig = stages[currentStageIndex]!;

const navigationHandlers = {
nextPage: () => {
Expand Down Expand Up @@ -99,6 +101,7 @@ function InterviewProvider({
protocol,
interviewId,
stageConfig,
currentStageIndex,
}}
>
{children}
Expand All @@ -113,12 +116,14 @@ const useInterview = () => {
networkHandlers,
navigationHandlers,
stageConfig,
currentStageIndex,
} = useContext(InterviewContext);

return {
network,
protocol,
stageConfig,
currentStageIndex,
...networkHandlers,
...navigationHandlers,
};
Expand Down
1 change: 0 additions & 1 deletion public/images/beam.svg

This file was deleted.

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit e7d13fe

Please sign in to comment.