2020-06-01 02:08:21 -04:00
|
|
|
import { getFormData } from '~/diffs/store/utils';
|
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
export const getDraftReplyFormData = (data) => ({
|
2020-06-01 02:08:21 -04:00
|
|
|
endpoint: data.notesData.draftsPath,
|
|
|
|
data,
|
|
|
|
});
|
|
|
|
|
2020-12-23 16:10:24 -05:00
|
|
|
export const getDraftFormData = (params) => ({
|
2020-06-01 02:08:21 -04:00
|
|
|
endpoint: params.notesData.draftsPath,
|
|
|
|
data: getFormData(params),
|
|
|
|
});
|
|
|
|
|
|
|
|
export const parallelLineKey = (line, side) => (line[side] ? line[side].line_code : '');
|
|
|
|
|
|
|
|
export const showDraftOnSide = (line, side) => {
|
|
|
|
// inline mode
|
|
|
|
if (side === null) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// parallel
|
|
|
|
if (side === 'left' || side === 'right') {
|
|
|
|
const otherSide = side === 'left' ? 'right' : 'left';
|
|
|
|
const thisCode = (line[side] && line[side].line_code) || '';
|
|
|
|
const otherCode = (line[otherSide] && line[otherSide].line_code) || '';
|
|
|
|
|
|
|
|
// either the lineCodes are different
|
|
|
|
// or if they're the same, only show on the left side
|
|
|
|
if (thisCode !== otherCode || (side === 'left' && thisCode === otherCode)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|