Skip to content

Commit

Permalink
feat: first working version
Browse files Browse the repository at this point in the history
  • Loading branch information
juancarlosfarah committed May 2, 2023
1 parent 1f654d1 commit 33f438a
Show file tree
Hide file tree
Showing 61 changed files with 5,427 additions and 605 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
29 changes: 24 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
{
"name": "graasp-app-starter-ts-vite",
"version": "0.0.0",
"name": "graasp-app-chatbot",
"version": "0.1.0",
"license": "AGPL-3.0-only",
"author": "Graasp",
"contributors": [
"Juan Carlos Farah",
"Basile Spaenlehauer"
],
"homepage": ".",
"dependencies": {
"@codemirror/lang-java": "6.0.1",
"@codemirror/lang-javascript": "6.1.7",
"@codemirror/lang-python": "6.1.2",
"@emotion/react": "11.10.6",
"@emotion/styled": "11.10.6",
"@graasp/apps-query-client": "github:graasp/graasp-apps-query-client#77-move-to-vite-for-bundling",
"@graasp/apps-query-client": "github:graasp/graasp-apps-query-client#79-persist",
"@graasp/sdk": "0.11.0",
"@graasp/ui": "2.4.1",
"@mui/icons-material": "5.11.16",
Expand All @@ -19,18 +23,30 @@
"@sentry/browser": "7.44.2",
"@sentry/react": "7.44.2",
"@sentry/tracing": "7.44.2",
"@tanstack/react-query": "^4.28.0",
"@tanstack/react-query-devtools": "^4.28.0",
"@tanstack/react-query": "4.29.5",
"@tanstack/react-query-devtools": "4.29.5",
"@types/file-saver": "2.0.5",
"@types/node": "17.0.45",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"@uiw/react-codemirror": "4.19.16",
"date-fns": "2.29.3",
"file-saver": "2.0.5",
"i18next": "22.4.13",
"immutable": "4.3.0",
"lodash.isobject": "3.0.2",
"lodash.isstring": "4.0.1",
"prism-react-renderer": "^2.0.3",
"qs": "6.11.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "12.2.0",
"react-markdown": "8.0.7",
"react-mde": "12.0.8",
"react-router-dom": "^6.10.0",
"react-toastify": "9.1.2",
"remark-breaks": "^3.0.2",
"remark-gfm": "^3.0.1",
"typescript": "4.9.5"
},
"scripts": {
Expand Down Expand Up @@ -58,6 +74,9 @@
"@cypress/code-coverage": "3.10.4",
"@trivago/prettier-plugin-sort-imports": "4.1.1",
"@types/i18n": "0.13.6",
"@types/lodash.isequal": "^4.5.6",
"@types/lodash.isobject": "^3.0.7",
"@types/lodash.isstring": "^4.0.7",
"@types/uuid": "9.0.1",
"@typescript-eslint/eslint-plugin": "5.56.0",
"@typescript-eslint/parser": "5.56.0",
Expand Down
Binary file added public/favicon.ico
Binary file not shown.
Binary file added public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "Chatbot",
"name": "Graasp Chatbot",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
20 changes: 20 additions & 0 deletions src/config/appActionsTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export enum APP_ACTIONS_TYPES {
RUN_CODE = 'run_code',
SAVE_CODE = 'save_code',
CLEAR_OUTPUT = 'clear_output',
OPEN_FIGURE = 'open_figure',
STOP_EXECUTION_DURING_PROMPT = 'stop_execution_during_prompt',
STOP_EXECUTION = 'stop_execution',
SUBMITTED_INPUT = 'submitted_input',
CANCEL_PROMPT = 'cancel_prompt',
INITIALIZE_EXECUTION = 'initialize_execution',
NEW_FIGURE = 'new_figure',
SEND_PROMPT = 'send_prompt',

// Review actions
CREATE_COMMENT = 'create_comment',
EDIT_COMMENT = 'edit_comment',
REPORT_COMMENT = 'report_comment',
DELETE_COMMENT = 'delete_comment',
RESPOND_COMMENT = 'respond_comment',
}
20 changes: 20 additions & 0 deletions src/config/appDataTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
enum APP_DATA_TYPES {
COMMENT = 'comment',
TEACHER_COMMENT = 'teacher_comment',
BOT_COMMENT = 'bot_comment',
CODE = 'code',
FLAG = 'flag',
}

enum APP_DATA_VISIBILITY {
MEMBER = 'member',
ITEM = 'item',
}

export const COMMENT_APP_DATA_TYPES: string[] = [
APP_DATA_TYPES.COMMENT,
APP_DATA_TYPES.TEACHER_COMMENT,
APP_DATA_TYPES.BOT_COMMENT,
];

export { APP_DATA_TYPES, APP_DATA_VISIBILITY };
26 changes: 26 additions & 0 deletions src/config/appSettingsTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export const GENERAL_SETTINGS_NAME = 'GENERAL_SETTINGS';
export const CODE_EXECUTION_SETTINGS_NAME = 'CODE_EXECUTION_SETTINGS';
export const CHATBOT_PROMPT_SETTINGS_NAME = 'CHATBOT_PROMPT_SETTINGS';
export const DIFF_VIEW_SETTINGS_NAME = 'DIFF_VIEW_SETTINGS';
export const APP_MODE_SETTINGS_NAME = 'APP_MODE_SETTINGS';
export const DATA_FILE_LIST_SETTINGS_NAME = 'DATA_FILE_LIST_SETTINGS';
export const INSTRUCTOR_CODE_VERSION_SETTINGS_NAME = 'INSTRUCTOR_CODE_VERSION';
export const DATA_FILE_SETTINGS_NAME = 'DATA_FILE_SETTING';

export enum CodeEditorSubmitTarget {
Settings,
Code,
}

export enum AppMode {
Execute = 'Execute',
Review = 'Review',
Collaborate = 'Collaborate',
Explain = 'Explain',
}

export type DataFile = {
appSettingId: string;
fileName: string;
virtualPath: string;
};
50 changes: 50 additions & 0 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
export const GRAASP_LOGO_HEADER_HEIGHT = 40;
export const BUTTON_LOADER_SIZE = 24;

// Admin view constants
export const NB_COL_TABLE_VIEW_TABLE = 4;

// reset timeout in ms for settings dialog
export const CLOSE_SETTINGS_TIMEOUT = 500;

// commit message truncation length
export const DEFAULT_TRUNCATION_COMMIT_MESSAGE_LENGTH = 15;

export const MAX_INITIALS_AVATAR = 2;

export const DEFAULT_REPL_INPUT_VALUE = '';

export const ANONYMOUS_USER = 'You';
export const INSTRUCTOR_CODE_NAME = 'Default';

export const INSTRUCTOR_CODE_ID = 'instructor';

export const JAVASCRIPT = 'javascript';
export const JAVA = 'java';
export const PYTHON = 'python';
export const MATLAB = 'matlab';
export const JSON_LANG = 'json';

export const REVIEW_MODE_INDIVIDUAL = 'individual';
export const REVIEW_MODE_COLLABORATIVE = 'collaborative';

export const VISIBILITY_MEMBER = 'member';
export const VISIBILITY_ITEM = 'item';

export const REVIEW_MODES = [
{
label: 'Individual - Each student works in isolation',
value: REVIEW_MODE_INDIVIDUAL,
},
{
label: 'Collaborative - Students see other students work',
value: REVIEW_MODE_COLLABORATIVE,
},
] as const;

export const DEFAULT_BOT_USERNAME = 'Graasp Bot';

// maximum number of messages allowed in a chatbot thread
export const MAX_CHATBOT_THREAD_LENGTH = 50;

export const DEFAULT_CHATBOT_PROMPT_APP_DATA = { chatbotPromptSettingId: '' };
3 changes: 3 additions & 0 deletions src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
VITE_GA_MEASUREMENT_ID,
VITE_MOCK_API,
VITE_API_HOST,
VITE_OPEN_AI_API_URL,
} = window.Cypress ? Cypress.env() : import.meta.env;

export const MOCK_API = VITE_MOCK_API === 'true';
Expand All @@ -15,3 +16,5 @@ export const VERSION = VITE_VERSION || 'latest';
export const GRAASP_APP_ID = VITE_GRAASP_APP_ID;
export const SENTRY_ENV = VITE_SENTRY_ENV;
export const SENTRY_DSN = VITE_SENTRY_DSN;

export const OPEN_AI_API_URL = VITE_OPEN_AI_API_URL;
11 changes: 11 additions & 0 deletions src/config/layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export enum AppView {
LoadingView,
CodeReview,
CodeEditor,
CodeExecution,
DiffView,
}

export const SMALL_BORDER_RADIUS = '4px';
export const BIG_BORDER_RADIUS = '8px';
export const MAX_REPL_HEIGHT = '60vh';
Loading

0 comments on commit 33f438a

Please sign in to comment.