Skip to content

Commit

Permalink
Merge pull request #941 from rdmorganiser/interview
Browse files Browse the repository at this point in the history
feat(interview): Rewrite interview using React and Redux [0]
  • Loading branch information
jochenklar authored Dec 6, 2024
2 parents c486085 + 9c1477c commit 612c989
Show file tree
Hide file tree
Showing 117 changed files with 5,527 additions and 50 deletions.
277 changes: 276 additions & 1 deletion package-lock.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"build:dist": "webpack --config webpack.config.js --mode production --env ignore-perf --fail-on-warnings",
"build:prod": "webpack --config webpack.config.js --mode production",
"build": "webpack --config webpack.config.js --mode development",
"watch": "webpack --config webpack.config.js --mode development --watch"
"watch": "webpack --config webpack.config.js --mode development --watch",
"lint": "eslint --ext .js rdmo/"
},
"author": "RDMO Arbeitsgemeinschaft <rdmorganiser.github.io>",
"license": "Apache-2.0",
Expand All @@ -20,6 +21,7 @@
"classnames": "^2.5.1",
"date-fns": "^3.6.0",
"font-awesome": "4.7.0",
"html-to-text": "^9.0.5",
"jquery": "^3.7.1",
"js-cookie": "^3.0.5",
"lodash": "^4.17.21",
Expand All @@ -28,6 +30,7 @@
"react": "^18.3.1",
"react-bootstrap": "0.33.1",
"react-datepicker": "7.3.0",
"react-diff-viewer-continued": "^3.4.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.3.1",
Expand All @@ -37,7 +40,7 @@
"redux": "^4.1.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"react-diff-viewer-continued": "^3.4.0"
"use-debounce": "^10.0.0"
},
"devDependencies": {
"@babel/cli": "^7.24.1",
Expand Down
2 changes: 2 additions & 0 deletions rdmo/core/assets/js/utils/lang.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// take the baseurl from the <head> of the django template
export default document.querySelector('html').getAttribute('lang')
16 changes: 15 additions & 1 deletion rdmo/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,21 @@
'PROJECT_TABLE_PAGE_SIZE'
]

TEMPLATES_API = []
TEMPLATES_API = [
'projects/project_interview_add_set_help.html',
'projects/project_interview_add_value_help.html',
'projects/project_interview_buttons_help.html',
'projects/project_interview_done.html',
'projects/project_interview_error.html',
'projects/project_interview_multiple_values_warning.html',
'projects/project_interview_navigation_help.html',
'projects/project_interview_overview_help.html',
'projects/project_interview_page_help.html',
'projects/project_interview_page_tabs_help.html',
'projects/project_interview_progress_help.html',
'projects/project_interview_question_help.html',
'projects/project_interview_questionset_help.html',
]

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
DEFAULT_FROM_EMAIL = '[email protected]'
Expand Down
4 changes: 2 additions & 2 deletions rdmo/core/templates/core/base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load static compress core_tags %}<!DOCTYPE html>
<html>
{% load static compress core_tags i18n %}{% get_current_language as lang_code %}<!DOCTYPE html>
<html lang="{{ lang_code }}">
<head>
{% include 'core/base_head.html' %}

Expand Down
23 changes: 0 additions & 23 deletions rdmo/management/assets/js/containers/Pending.js

This file was deleted.

3 changes: 2 additions & 1 deletion rdmo/management/assets/js/management.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import configureStore from './store/configureStore'
import { DndProvider } from 'react-dnd'
import { HTML5Backend } from 'react-dnd-html5-backend'

import Pending from '../../../core/assets/js/containers/Pending'

import Main from './containers/Main'
import Sidebar from './containers/Sidebar'
import Pending from './containers/Pending'

const store = configureStore()

Expand Down
2 changes: 2 additions & 0 deletions rdmo/options/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def get_options(self, project, search=None, user=None, site=None):

class SimpleProvider(Provider):

refresh = True

def get_options(self, project, search=None, user=None, site=None):
return [
{
Expand Down
2 changes: 1 addition & 1 deletion rdmo/projects/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def project_owners(self, obj):
@admin.register(Value)
class ValueAdmin(admin.ModelAdmin):
search_fields = ('attribute__uri', 'project__title', 'snapshot__title', 'project__user__username')
list_display = ('attribute', 'set_prefix', 'set_index', 'collection_index', 'value_type',
list_display = ('attribute', 'set_prefix', 'set_index', 'collection_index', 'set_collection', 'value_type',
'project_title', 'project_owners', 'snapshot_title', 'updated', 'created')
list_filter = ('value_type', )

Expand Down
35 changes: 35 additions & 0 deletions rdmo/projects/assets/js/interview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react'
import { createRoot } from 'react-dom/client'
import { Provider } from 'react-redux'

import configureStore from './interview/store/configureStore'

import { DndProvider } from 'react-dnd'
import { HTML5Backend } from 'react-dnd-html5-backend'

import Pending from '../../../core/assets/js/containers/Pending'

import Main from './interview/containers/Main'
import Sidebar from './interview/containers/Sidebar'

const store = configureStore()

createRoot(document.getElementById('main')).render(
<DndProvider backend={HTML5Backend}>
<Provider store={store}>
<Main />
</Provider>
</DndProvider>
)

createRoot(document.getElementById('sidebar')).render(
<Provider store={store}>
<Sidebar />
</Provider>
)

createRoot(document.getElementById('pending')).render(
<Provider store={store}>
<Pending />
</Provider>
)
52 changes: 52 additions & 0 deletions rdmo/projects/assets/js/interview/actions/actionTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
export const NOOP = 'NOOP'

export const FETCH_OVERVIEW_INIT = 'FETCH_OVERVIEW_INIT'
export const FETCH_OVERVIEW_ERROR = 'FETCH_OVERVIEW_ERROR'
export const FETCH_OVERVIEW_SUCCESS = 'FETCH_OVERVIEW_SUCCESS'

export const FETCH_PROGRESS_INIT = 'FETCH_PROGRESS_INIT'
export const FETCH_PROGRESS_ERROR = 'FETCH_PROGRESS_ERROR'
export const FETCH_PROGRESS_SUCCESS = 'FETCH_PROGRESS_SUCCESS'

export const UPDATE_PROGRESS_INIT = 'UPDATE_PROGRESS_INIT'
export const UPDATE_PROGRESS_SUCCESS = 'UPDATE_PROGRESS_SUCCESS'
export const UPDATE_PROGRESS_ERROR = 'UPDATE_PROGRESS_ERROR'

export const FETCH_PAGE_INIT = 'FETCH_PAGE_INIT'
export const FETCH_PAGE_ERROR = 'FETCH_PAGE_ERROR'
export const FETCH_PAGE_SUCCESS = 'FETCH_PAGE_SUCCESS'

export const FETCH_NAVIGATION_INIT = 'FETCH_NAVIGATION_INIT'
export const FETCH_NAVIGATION_ERROR = 'FETCH_NAVIGATION_ERROR'
export const FETCH_NAVIGATION_SUCCESS = 'FETCH_NAVIGATION_SUCCESS'

export const FETCH_OPTIONS_INIT = 'FETCH_OPTIONS_INIT'
export const FETCH_OPTIONS_SUCCESS = 'FETCH_OPTIONS_SUCCESS'
export const FETCH_OPTIONS_ERROR = 'FETCH_OPTIONS_ERROR'

export const FETCH_VALUES_INIT = 'FETCH_VALUES_INIT'
export const FETCH_VALUES_SUCCESS = 'FETCH_VALUES_SUCCESS'
export const FETCH_VALUES_ERROR = 'FETCH_VALUES_ERROR'

export const RESOLVE_CONDITION_INIT = 'RESOLVE_CONDITION_INIT'
export const RESOLVE_CONDITION_SUCCESS = 'RESOLVE_CONDITION_SUCCESS'
export const RESOLVE_CONDITION_ERROR = 'RESOLVE_CONDITION_ERROR'

export const CREATE_VALUE = 'CREATE_VALUE'
export const UPDATE_VALUE = 'UPDATE_VALUE'

export const STORE_VALUE_INIT = 'STORE_VALUE_INIT'
export const STORE_VALUE_SUCCESS = 'STORE_VALUE_SUCCESS'
export const STORE_VALUE_ERROR = 'STORE_VALUE_ERROR'

export const DELETE_VALUE_INIT = 'DELETE_VALUE_INIT'
export const DELETE_VALUE_SUCCESS = 'DELETE_VALUE_SUCCESS'
export const DELETE_VALUE_ERROR = 'DELETE_VALUE_ERROR'

export const ACTIVATE_SET = 'ACTIVATE_SET'

export const CREATE_SET = 'CREATE_SET'

export const DELETE_SET_INIT = 'DELETE_SET_INIT'
export const DELETE_SET_SUCCESS = 'DELETE_SET_SUCCESS'
export const DELETE_SET_ERROR = 'DELETE_SET_ERROR'
Loading

0 comments on commit 612c989

Please sign in to comment.