Skip to content

Commit

Permalink
remove planningActivity and comment leaflet ruler, select, timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
lilitkarapetyan committed Dec 13, 2023
1 parent 34ece0f commit 9bb20ca
Show file tree
Hide file tree
Showing 13 changed files with 11 additions and 243 deletions.
8 changes: 4 additions & 4 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<link rel='shortcut icon' href='/static/favicon.ico' />
<link rel='stylesheet' href='/static/leaflet.css' />
<link rel="stylesheet" href="/static/flatpickr/flatpickr.min.css">
<link rel='stylesheet' href='/static/leaflet/select/leaflet.select.css' />
<!-- <link rel='stylesheet' href='/static/leaflet/select/leaflet.select.css' />
<link rel='stylesheet' href='/static/leaflet/ruler/leaflet.ruler.css' />
<link rel='stylesheet' href='/static/leaflet/timeline/leaflet.timeline.css' />
<link rel='stylesheet' href='/static/leaflet/timeline/leaflet.timeline.css' /> -->
<meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no' />
<meta name='theme-color' content='#000000' />

Expand Down Expand Up @@ -48,7 +48,7 @@
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
<script type="module" src='/static/leaflet/timeline/leaflet.timeline.js'></script>
<!-- <script type="module" src='/static/leaflet/timeline/leaflet.timeline.js'></script>
<script type="module" src='/static/leaflet/select/leaflet.select.js'></script>
<script type="module" src='/static/leaflet/ruler/leaflet.ruler.js'></script>
<script type="module" src='/static/leaflet/ruler/leaflet.ruler.js'></script> -->
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ const MessageCreator: React.FC<PropTypes> = ({
clearCachedCreatorMessage,
draftMessage,
modifyForEdit,
modifyForSave,
editCallback
modifyForSave
}) => {
const privateMessageRef = createRef<HTMLTextAreaElement>()
const [formMessage, setFormMessage] = useState<any>()
Expand Down Expand Up @@ -167,7 +166,6 @@ const MessageCreator: React.FC<PropTypes> = ({
messageContent={messageContent}
modifyForEdit={modifyForEdit}
modifyForSave={modifyForSave}
editCallback={editCallback}
/>
{privateMessage && (
<div className="flex-content form-group">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ChannelTypes, CoreMessage, ForceData, MessageDetails, MessageStructure } from 'src/custom-types'
import { MouseEvent } from 'react'
import { EditCallback } from 'src/local/molecules/json-editor/helpers/setupEditor'

export default interface PropTypes {
schema: any
Expand Down Expand Up @@ -41,8 +40,4 @@ export default interface PropTypes {
*/
modifyForSave?: { (document: Record<string, any>): Record<string, any> }

/**
* user has clicked on custom edit button
*/
editCallback?: EditCallback
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ const NewMessage: React.FC<PropTypes> = ({
title,
hideTemplateSelector,
modifyForEdit,
modifyForSave,
editCallback
modifyForSave
}) => {
const prevTemplates: TemplateBody = usePrevious(templates)
const [selectedSchema, setSelectedSchema] = useState<Record<string, any> | null>(null)
Expand Down Expand Up @@ -154,7 +153,6 @@ const NewMessage: React.FC<PropTypes> = ({
draftMessage={draftMessage}
modifyForEdit={modifyForEdit}
modifyForSave={modifyForSave}
editCallback={editCallback}
/>
</Collapsible>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ChannelTypes, CoreMessage, ForceData, MessageDetails, MessageStructure, TemplateBody } from 'src/custom-types'
import { EditCallback } from 'src/local/molecules/json-editor/helpers/setupEditor'

export default interface PropTypes {
orderableChannel: boolean
Expand Down Expand Up @@ -45,8 +44,4 @@ export default interface PropTypes {
* modify document prior to being stored
*/
modifyForSave?: { (document: Record<string, any>): Record<string, any> }
/**
* user has clicked on custom edit button
*/
editCallback?: EditCallback
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import { JSONEditor } from '@json-editor/json-editor'
import { Editor, PlannedActivityGeometry } from 'src/custom-types'
import { Editor } from 'src/custom-types'
import { RefObject } from 'react'
import { initLocationEditor } from '../custom-editors/location-editor'
import { configDateTimeCustomValidation } from './jsonValidation'

export type EditCallback = (locations: PlannedActivityGeometry[]) => void
export type OnLocationEditorLoaded = (editorElm: HTMLDivElement) => void

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
const setupEditor = (editor: Editor | null, schema: any, ref: RefObject<HTMLDivElement>,
jsonEditorConfig: Record<string, any>, editCallback: EditCallback, onLocationEditorLoaded: OnLocationEditorLoaded,
jsonEditorConfig: Record<string, any>,
showErrorsMode?: string): Editor | null => {
if (editor !== null) {
editor.destroy()
editor = null
}

initLocationEditor(editCallback, onLocationEditorLoaded)
configDateTimeCustomValidation()

const disableCollapse = 'disable_collapse'
Expand Down
20 changes: 3 additions & 17 deletions client/src/Components/local/molecules/json-editor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Editor, PlannedActivityGeometry, TemplateBody } from 'src/custom-types'
import { Editor, TemplateBody } from 'src/custom-types'
import { configDateTimeLocal, deepCopy, usePrevious } from 'src/Helpers'
import 'bootstrap/dist/css/bootstrap.min.css'
import { isEqual } from 'lodash'
Expand Down Expand Up @@ -32,9 +32,7 @@ export const JsonEditor: React.FC<Props> = ({
onCancelEdit,
modifyForSave,
confirmCancel = false,
viewSaveButton = false,
editCallback,
onLocationEditorLoaded
viewSaveButton = false
}) => {
const jsonEditorRef = useRef<HTMLDivElement>(null)
const [editor, setEditor] = useState<Editor | null>(null)
Expand All @@ -56,7 +54,6 @@ export const JsonEditor: React.FC<Props> = ({
const destroyEditor = (editorObject: Editor | null): void => {
if (editorObject && (editorObject.ready || !editorObject.destroyed)) { editorObject.destroy() }
}

const fixDate = (value: { [property: string]: any }): { [property: string]: any } => {
const cleanDate = (date: string): string => {
if (!date.includes('Z')) {
Expand Down Expand Up @@ -134,17 +131,6 @@ export const JsonEditor: React.FC<Props> = ({
}
}

const localEditCallback = (locations: PlannedActivityGeometry[]): void => {
// TODO: we should only call the `editCallback` if this document
// is being edited. The `beingEdited` flag should specify this,
// but it is always false
editCallback && editCallback(locations)
}

const onEditorLoaded = (editorElm: HTMLDivElement) => {
onLocationEditorLoaded && onLocationEditorLoaded(editorElm)
}

const initEditor = (): () => void => {
const hideArrayButtons = disabled
const jsonEditorConfig = hideArrayButtons
Expand All @@ -160,7 +146,7 @@ export const JsonEditor: React.FC<Props> = ({

// if a title was supplied, replace the title in the schema
const schemaWithTitle = title ? { ...customizedSchema, title: title } : customizedSchema
const nextEditor = setupEditor(editor, schemaWithTitle, jsonEditorRef, jsonEditorConfig, localEditCallback, onEditorLoaded, alwaysShowEditorErrors)
const nextEditor = setupEditor(editor, schemaWithTitle, jsonEditorRef, jsonEditorConfig, alwaysShowEditorErrors)

const changeListenter = (): void => {
if (nextEditor) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { MessageCustom, MessageStructure, TemplateBody, TempletCreatorBody } from 'src/custom-types'
import { EditCallback } from '../helpers/setupEditor'

export default interface Props {
onChange?: (nextMessage: MessageCustom) => void
Expand Down Expand Up @@ -73,10 +72,4 @@ export default interface Props {
*/
modifyForSave?: { (document: Record<string, any>): Record<string, any> }

/**
* user has clicked on custom edit button
*/
editCallback?: EditCallback

onLocationEditorLoaded?: (editorElm: HTMLDivElement) => void
}
9 changes: 0 additions & 9 deletions client/src/config/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ export enum CollaborativePermission {
CanUnClaim
}

/**
* the type of geometry that can represent planning activities
*/
export enum GeometryType {
point = 'Point',
polyline = 'Polyline',
polygon = 'Polygon'
}

/** the initial state for new messages in a collab edit channel */
export enum InitialStates {
PENDING_REVIEW = 'PENDING_REVIEW',
Expand Down
1 change: 0 additions & 1 deletion client/src/custom-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export {
} from './message.d'
export { MessagesActionTypes, MessagesDispatch, SetCurrentViewFromURI } from './messages-action.d'
export * from './participant.d'
export * from './planning-activity.d'
export * from './player-log-actions.d'
export * from './player-log.d'
export * from './player-ui-actions.d'
Expand Down
63 changes: 0 additions & 63 deletions client/src/custom-types/planning-activity.d.ts

This file was deleted.

Empty file removed server/.config.json
Empty file.

0 comments on commit 9bb20ca

Please sign in to comment.