@rimori/client 1.4.10 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -49
- package/dist/react-client/src/plugin/ThemeSetter.d.ts +2 -0
- package/dist/react-client/src/plugin/ThemeSetter.js +19 -0
- package/dist/react-client/src/utils/PluginUtils.d.ts +2 -0
- package/dist/react-client/src/utils/PluginUtils.js +23 -0
- package/dist/{cli → rimori-client/src/cli}/scripts/init/main.js +0 -0
- package/dist/{cli → rimori-client/src/cli}/scripts/release/release.js +0 -0
- package/dist/{core → rimori-client/src}/controller/AIController.d.ts +1 -1
- package/dist/{core → rimori-client/src}/controller/AIController.js +2 -2
- package/dist/{plugin/AccomplishmentHandler.d.ts → rimori-client/src/controller/AccomplishmentController.d.ts} +1 -1
- package/dist/{plugin/AccomplishmentHandler.js → rimori-client/src/controller/AccomplishmentController.js} +1 -1
- package/dist/{core → rimori-client/src}/controller/ExerciseController.d.ts +8 -6
- package/dist/{core → rimori-client/src}/controller/ExerciseController.js +10 -9
- package/dist/{core → rimori-client/src}/controller/ObjectController.d.ts +1 -1
- package/dist/{core → rimori-client/src}/controller/ObjectController.js +1 -1
- package/dist/{core → rimori-client/src}/controller/SettingsController.d.ts +2 -2
- package/dist/{core → rimori-client/src}/controller/SharedContentController.d.ts +1 -1
- package/dist/{core → rimori-client/src}/controller/VoiceController.d.ts +1 -1
- package/dist/rimori-client/src/index.d.ts +11 -0
- package/dist/rimori-client/src/index.js +10 -0
- package/dist/{plugin/PluginController.d.ts → rimori-client/src/plugin/CommunicationHandler.d.ts} +3 -7
- package/dist/{plugin/PluginController.js → rimori-client/src/plugin/CommunicationHandler.js} +3 -28
- package/dist/{plugin → rimori-client/src/plugin}/RimoriClient.d.ts +67 -68
- package/dist/{plugin → rimori-client/src/plugin}/RimoriClient.js +101 -43
- package/dist/{worker → rimori-client/src/worker}/WorkerSetup.js +2 -2
- package/example/docs/devdocs.md +1 -1
- package/package.json +4 -26
- package/src/{core/controller → controller}/AIController.ts +3 -3
- package/src/{plugin/AccomplishmentHandler.ts → controller/AccomplishmentController.ts} +1 -1
- package/src/{core/controller → controller}/ExerciseController.ts +14 -11
- package/src/{core/controller → controller}/ObjectController.ts +2 -2
- package/src/{core/controller → controller}/SettingsController.ts +2 -2
- package/src/{core/controller → controller}/SharedContentController.ts +1 -1
- package/src/{core/controller → controller}/VoiceController.ts +2 -2
- package/src/fromRimori/readme.md +1 -1
- package/src/index.ts +8 -8
- package/src/plugin/{PluginController.ts → CommunicationHandler.ts} +8 -36
- package/src/plugin/RimoriClient.ts +125 -118
- package/src/worker/WorkerSetup.ts +5 -3
- package/tsconfig.json +4 -2
- package/dist/cli/scripts/release/release-translation-upload.d.ts +0 -6
- package/dist/cli/scripts/release/release-translation-upload.js +0 -87
- package/dist/components/CRUDModal.d.ts +0 -17
- package/dist/components/CRUDModal.js +0 -24
- package/dist/components/MarkdownEditor.d.ts +0 -8
- package/dist/components/MarkdownEditor.js +0 -48
- package/dist/components/Spinner.d.ts +0 -8
- package/dist/components/Spinner.js +0 -4
- package/dist/components/ai/Assistant.d.ts +0 -9
- package/dist/components/ai/Assistant.js +0 -58
- package/dist/components/ai/Avatar.d.ts +0 -14
- package/dist/components/ai/Avatar.js +0 -59
- package/dist/components/ai/EmbeddedAssistent/AudioInputField.d.ts +0 -7
- package/dist/components/ai/EmbeddedAssistent/AudioInputField.js +0 -37
- package/dist/components/ai/EmbeddedAssistent/CircleAudioAvatar.d.ts +0 -8
- package/dist/components/ai/EmbeddedAssistent/CircleAudioAvatar.js +0 -79
- package/dist/components/ai/EmbeddedAssistent/TTS/MessageSender.d.ts +0 -19
- package/dist/components/ai/EmbeddedAssistent/TTS/MessageSender.js +0 -91
- package/dist/components/ai/EmbeddedAssistent/TTS/Player.d.ts +0 -27
- package/dist/components/ai/EmbeddedAssistent/TTS/Player.js +0 -185
- package/dist/components/ai/EmbeddedAssistent/VoiceRecoder.d.ts +0 -11
- package/dist/components/ai/EmbeddedAssistent/VoiceRecoder.js +0 -95
- package/dist/components/ai/utils.d.ts +0 -6
- package/dist/components/ai/utils.js +0 -13
- package/dist/components/audio/Playbutton.d.ts +0 -15
- package/dist/components/audio/Playbutton.js +0 -80
- package/dist/components/components/ContextMenu.d.ts +0 -10
- package/dist/components/components/ContextMenu.js +0 -135
- package/dist/components.d.ts +0 -10
- package/dist/components.js +0 -11
- package/dist/core/controller/EnhancedUserInfo.d.ts +0 -0
- package/dist/core/controller/EnhancedUserInfo.js +0 -1
- package/dist/core/core.d.ts +0 -14
- package/dist/core/core.js +0 -7
- package/dist/hooks/I18nHooks.d.ts +0 -11
- package/dist/hooks/I18nHooks.js +0 -25
- package/dist/hooks/UseChatHook.d.ts +0 -10
- package/dist/hooks/UseChatHook.js +0 -29
- package/dist/i18n/I18nHooks.d.ts +0 -11
- package/dist/i18n/I18nHooks.js +0 -25
- package/dist/i18n/Translator.d.ts +0 -43
- package/dist/i18n/Translator.js +0 -118
- package/dist/i18n/config.d.ts +0 -7
- package/dist/i18n/config.js +0 -20
- package/dist/i18n/createI18nInstance.d.ts +0 -7
- package/dist/i18n/createI18nInstance.js +0 -31
- package/dist/i18n/hooks.d.ts +0 -11
- package/dist/i18n/hooks.js +0 -25
- package/dist/i18n/index.d.ts +0 -4
- package/dist/i18n/index.js +0 -4
- package/dist/i18n/types.d.ts +0 -7
- package/dist/i18n/types.js +0 -1
- package/dist/i18n/useRimoriI18n.d.ts +0 -11
- package/dist/i18n/useRimoriI18n.js +0 -41
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -11
- package/dist/plugin/Translator.d.ts +0 -38
- package/dist/plugin/Translator.js +0 -101
- package/dist/providers/PluginProvider.d.ts +0 -12
- package/dist/providers/PluginProvider.js +0 -152
- package/dist/style.css +0 -110
- package/dist/style.css.map +0 -1
- package/dist/utils/Language.d.ts +0 -67
- package/dist/utils/Language.js +0 -69
- package/dist/utils/LanguageClass.d.ts +0 -36
- package/dist/utils/LanguageClass.example.d.ts +0 -0
- package/dist/utils/LanguageClass.example.js +0 -1
- package/dist/utils/LanguageClass.js +0 -50
- package/dist/utils/LanguageClass.test.d.ts +0 -0
- package/dist/utils/LanguageClass.test.js +0 -1
- package/src/components/CRUDModal.tsx +0 -75
- package/src/components/MarkdownEditor.tsx +0 -144
- package/src/components/Spinner.tsx +0 -29
- package/src/components/ai/Assistant.tsx +0 -96
- package/src/components/ai/Avatar.tsx +0 -99
- package/src/components/ai/EmbeddedAssistent/AudioInputField.tsx +0 -73
- package/src/components/ai/EmbeddedAssistent/CircleAudioAvatar.tsx +0 -107
- package/src/components/ai/EmbeddedAssistent/TTS/MessageSender.ts +0 -96
- package/src/components/ai/EmbeddedAssistent/TTS/Player.ts +0 -197
- package/src/components/ai/EmbeddedAssistent/VoiceRecoder.tsx +0 -129
- package/src/components/ai/utils.ts +0 -21
- package/src/components/audio/Playbutton.tsx +0 -126
- package/src/components/components/ContextMenu.tsx +0 -179
- package/src/components.ts +0 -11
- package/src/core/core.ts +0 -15
- package/src/hooks/I18nHooks.ts +0 -33
- package/src/hooks/UseChatHook.ts +0 -38
- package/src/plugin/ThemeSetter.ts +0 -23
- package/src/providers/PluginProvider.tsx +0 -209
- package/src/style.scss +0 -136
- package/src/utils/PluginUtils.ts +0 -22
- /package/dist/{plugin → react-client/plugin}/ThemeSetter.d.ts +0 -0
- /package/dist/{plugin → react-client/plugin}/ThemeSetter.js +0 -0
- /package/dist/{utils/PluginUtils.d.ts → react-client/src/utils/FullscreenUtils.d.ts} +0 -0
- /package/dist/{utils/PluginUtils.js → react-client/src/utils/FullscreenUtils.js} +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/dev-registration.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/dev-registration.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/env-setup.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/env-setup.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/file-operations.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/file-operations.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/html-cleaner.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/html-cleaner.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/main.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/package-setup.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/package-setup.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/router-transformer.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/router-transformer.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/tailwind-config.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/tailwind-config.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/vite-config.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/init/vite-config.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/release/detect-translation-languages.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/release/detect-translation-languages.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/release/release-config-upload.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/release/release-config-upload.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/release/release-db-update.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/release/release-db-update.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/release/release-file-upload.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/release/release-file-upload.js +0 -0
- /package/dist/{cli → rimori-client/src/cli}/scripts/release/release.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/types/DatabaseTypes.d.ts +0 -0
- /package/dist/{cli → rimori-client/src/cli}/types/DatabaseTypes.js +0 -0
- /package/dist/{plugin → rimori-client/src/controller}/AudioController.d.ts +0 -0
- /package/dist/{plugin → rimori-client/src/controller}/AudioController.js +0 -0
- /package/dist/{core → rimori-client/src}/controller/SettingsController.js +0 -0
- /package/dist/{core → rimori-client/src}/controller/SharedContentController.js +0 -0
- /package/dist/{plugin → rimori-client/src/controller}/TranslationController.d.ts +0 -0
- /package/dist/{plugin → rimori-client/src/controller}/TranslationController.js +0 -0
- /package/dist/{core → rimori-client/src}/controller/VoiceController.js +0 -0
- /package/dist/{fromRimori → rimori-client/src/fromRimori}/EventBus.d.ts +0 -0
- /package/dist/{fromRimori → rimori-client/src/fromRimori}/EventBus.js +0 -0
- /package/dist/{fromRimori → rimori-client/src/fromRimori}/PluginTypes.d.ts +0 -0
- /package/dist/{fromRimori → rimori-client/src/fromRimori}/PluginTypes.js +0 -0
- /package/dist/{plugin → rimori-client/src/plugin}/Logger.d.ts +0 -0
- /package/dist/{plugin → rimori-client/src/plugin}/Logger.js +0 -0
- /package/dist/{plugin → rimori-client/src/plugin}/StandaloneClient.d.ts +0 -0
- /package/dist/{plugin → rimori-client/src/plugin}/StandaloneClient.js +0 -0
- /package/dist/{utils → rimori-client/src/utils}/difficultyConverter.d.ts +0 -0
- /package/dist/{utils → rimori-client/src/utils}/difficultyConverter.js +0 -0
- /package/dist/{utils → rimori-client/src/utils}/endpoint.d.ts +0 -0
- /package/dist/{utils → rimori-client/src/utils}/endpoint.js +0 -0
- /package/dist/{worker → rimori-client/src/worker}/WorkerSetup.d.ts +0 -0
- /package/src/{plugin → controller}/AudioController.ts +0 -0
- /package/src/{plugin → controller}/TranslationController.ts +0 -0
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface FirstMessages {
|
|
2
|
-
instructions?: string;
|
|
3
|
-
userMessage?: string;
|
|
4
|
-
assistantMessage?: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function getFirstMessages(instructions: FirstMessages): any[] {
|
|
8
|
-
const messages = [];
|
|
9
|
-
|
|
10
|
-
if (instructions.instructions) {
|
|
11
|
-
messages.push({ id: '1', role: 'system', content: instructions.instructions });
|
|
12
|
-
}
|
|
13
|
-
if (instructions.userMessage) {
|
|
14
|
-
messages.push({ id: '2', role: 'user', content: instructions.userMessage });
|
|
15
|
-
}
|
|
16
|
-
if (instructions.assistantMessage) {
|
|
17
|
-
messages.push({ id: '3', role: 'assistant', content: instructions.assistantMessage });
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return messages;
|
|
21
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { FaPlayCircle, FaStopCircle } from 'react-icons/fa';
|
|
3
|
-
import { useRimori } from '../../providers/PluginProvider';
|
|
4
|
-
import { Spinner } from '../Spinner';
|
|
5
|
-
import { EventBus } from '../../fromRimori/EventBus';
|
|
6
|
-
|
|
7
|
-
type AudioPlayerProps = {
|
|
8
|
-
text: string;
|
|
9
|
-
voice?: string;
|
|
10
|
-
language?: string;
|
|
11
|
-
hide?: boolean;
|
|
12
|
-
playOnMount?: boolean;
|
|
13
|
-
initialSpeed?: number;
|
|
14
|
-
enableSpeedAdjustment?: boolean;
|
|
15
|
-
playListenerEvent?: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const AudioPlayOptions = [0.8, 0.9, 1.0, 1.1, 1.2, 1.5];
|
|
19
|
-
export type AudioPlayOptionType = 0.8 | 0.9 | 1.0 | 1.1 | 1.2 | 1.5;
|
|
20
|
-
|
|
21
|
-
let isFetchingAudio = false;
|
|
22
|
-
|
|
23
|
-
export const AudioPlayer: React.FC<AudioPlayerProps> = ({
|
|
24
|
-
text,
|
|
25
|
-
voice,
|
|
26
|
-
language,
|
|
27
|
-
hide,
|
|
28
|
-
playListenerEvent,
|
|
29
|
-
initialSpeed = 1.0,
|
|
30
|
-
playOnMount = false,
|
|
31
|
-
enableSpeedAdjustment = false,
|
|
32
|
-
}) => {
|
|
33
|
-
const [audioUrl, setAudioUrl] = useState<string | null>(null);
|
|
34
|
-
const [speed, setSpeed] = useState(initialSpeed);
|
|
35
|
-
const [isPlaying, setIsPlaying] = useState(false);
|
|
36
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
37
|
-
const { ai } = useRimori();
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (!playListenerEvent) return;
|
|
41
|
-
EventBus.on(playListenerEvent, () => togglePlayback());
|
|
42
|
-
}, [playListenerEvent]);
|
|
43
|
-
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
audioUrl && setAudioUrl(null);
|
|
46
|
-
return () => {
|
|
47
|
-
audioUrl && URL.revokeObjectURL(audioUrl);
|
|
48
|
-
};
|
|
49
|
-
}, [text]);
|
|
50
|
-
|
|
51
|
-
// Function to generate audio from text using API
|
|
52
|
-
const generateAudio = async () => {
|
|
53
|
-
setIsLoading(true);
|
|
54
|
-
|
|
55
|
-
const blob = await ai.getVoice(text, voice || (language ? 'aws_default' : 'openai_alloy'), 1, language);
|
|
56
|
-
setAudioUrl(URL.createObjectURL(blob));
|
|
57
|
-
setIsLoading(false);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// Effect to play audio when audioUrl changes and play state is true
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (!audioUrl || !isPlaying) return;
|
|
63
|
-
const audio = new Audio(audioUrl);
|
|
64
|
-
audio.playbackRate = speed;
|
|
65
|
-
audio
|
|
66
|
-
.play()
|
|
67
|
-
.then(() => {
|
|
68
|
-
audio.onended = () => {
|
|
69
|
-
setIsPlaying(false);
|
|
70
|
-
isFetchingAudio = false;
|
|
71
|
-
};
|
|
72
|
-
})
|
|
73
|
-
.catch((e) => {
|
|
74
|
-
console.warn('Error playing audio:', e);
|
|
75
|
-
setIsPlaying(false);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
return () => {
|
|
79
|
-
audio.pause();
|
|
80
|
-
};
|
|
81
|
-
}, [audioUrl, isPlaying, speed]);
|
|
82
|
-
|
|
83
|
-
const togglePlayback = () => {
|
|
84
|
-
if (!isPlaying && !audioUrl) {
|
|
85
|
-
generateAudio().then(() => setIsPlaying(true));
|
|
86
|
-
} else {
|
|
87
|
-
setIsPlaying((prev) => !prev);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
if (!playOnMount || isFetchingAudio) return;
|
|
93
|
-
isFetchingAudio = true;
|
|
94
|
-
// console.log("playOnMount", playOnMount);
|
|
95
|
-
togglePlayback();
|
|
96
|
-
}, [playOnMount]);
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<div className="group relative">
|
|
100
|
-
<div className="flex flex-row items-end">
|
|
101
|
-
{!hide && (
|
|
102
|
-
<button className="text-gray-500" onClick={togglePlayback} disabled={isLoading}>
|
|
103
|
-
{isLoading ? <Spinner /> : isPlaying ? <FaStopCircle size={'25px'} /> : <FaPlayCircle size={'25px'} />}
|
|
104
|
-
</button>
|
|
105
|
-
)}
|
|
106
|
-
{enableSpeedAdjustment && (
|
|
107
|
-
<div className="ml-1 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-row text-sm text-gray-500">
|
|
108
|
-
<span className="pr-1">Speed: </span>
|
|
109
|
-
<select
|
|
110
|
-
value={speed}
|
|
111
|
-
className="appearance-none cursor-pointer pr-0 p-0 rounded shadow leading-tight focus:outline-none focus:bg-gray-800 focus:ring bg-transparent border-0"
|
|
112
|
-
onChange={(e) => setSpeed(parseFloat(e.target.value))}
|
|
113
|
-
disabled={isLoading}
|
|
114
|
-
>
|
|
115
|
-
{AudioPlayOptions.map((s) => (
|
|
116
|
-
<option key={s} value={s}>
|
|
117
|
-
{s}
|
|
118
|
-
</option>
|
|
119
|
-
))}
|
|
120
|
-
</select>
|
|
121
|
-
</div>
|
|
122
|
-
)}
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
);
|
|
126
|
-
};
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
-
import { EventBus } from '../../fromRimori/EventBus';
|
|
3
|
-
import { RimoriClient } from '../../plugin/RimoriClient';
|
|
4
|
-
import { MenuEntry } from '../../fromRimori/PluginTypes';
|
|
5
|
-
|
|
6
|
-
export interface Position {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
text?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const ContextMenu = ({ client }: { client: RimoriClient }) => {
|
|
13
|
-
const [isOpen, setIsOpen] = useState<boolean>(false);
|
|
14
|
-
const [actions, setActions] = useState<MenuEntry[]>([]);
|
|
15
|
-
const [position, setPosition] = useState<Position>({ x: 0, y: 0 });
|
|
16
|
-
const [openOnTextSelect, setOpenOnTextSelect] = useState(false);
|
|
17
|
-
const [menuWidth, setMenuWidth] = useState<number>(0);
|
|
18
|
-
const menuRef = useRef<HTMLDivElement>(null);
|
|
19
|
-
const isMobile = window.innerWidth < 768;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Calculates position for mobile context menu based on selected text bounds.
|
|
23
|
-
* Centers the menu horizontally over the selected text and positions it 30px below the text's end.
|
|
24
|
-
* @param selectedText - The currently selected text
|
|
25
|
-
* @param menuWidth - The width of the menu to center properly
|
|
26
|
-
* @returns Position object with x and y coordinates
|
|
27
|
-
*/
|
|
28
|
-
const calculateMobilePosition = (selectedText: string, menuWidth: number = 0): Position => {
|
|
29
|
-
const selection = window.getSelection();
|
|
30
|
-
if (!selection || !selectedText) {
|
|
31
|
-
return { x: 0, y: 0, text: selectedText };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const range = selection.getRangeAt(0);
|
|
35
|
-
const rect = range.getBoundingClientRect();
|
|
36
|
-
|
|
37
|
-
// Center horizontally over the selected text, accounting for menu width
|
|
38
|
-
const centerX = rect.left + rect.width / 2 - menuWidth / 2;
|
|
39
|
-
|
|
40
|
-
// Position 12px below where the text ends vertically
|
|
41
|
-
const textEndY = rect.bottom + 12;
|
|
42
|
-
|
|
43
|
-
return { x: centerX, y: textEndY, text: selectedText };
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
const actions = client.plugin
|
|
48
|
-
.getPluginInfo()
|
|
49
|
-
.installedPlugins.flatMap((p) => p.context_menu_actions)
|
|
50
|
-
.filter(Boolean);
|
|
51
|
-
setActions(actions);
|
|
52
|
-
setOpenOnTextSelect(client.plugin.getUserInfo().context_menu_on_select);
|
|
53
|
-
|
|
54
|
-
EventBus.on<{ actions: MenuEntry[] }>('global.contextMenu.createActions', ({ data }) => {
|
|
55
|
-
setActions([...data.actions, ...actions]);
|
|
56
|
-
});
|
|
57
|
-
}, []);
|
|
58
|
-
|
|
59
|
-
// Update menu width when menu is rendered
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
if (isOpen && menuRef.current) {
|
|
62
|
-
setMenuWidth(menuRef.current.offsetWidth);
|
|
63
|
-
}
|
|
64
|
-
}, [isOpen, actions]);
|
|
65
|
-
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
// Track mouse position globally
|
|
68
|
-
const handleMouseMove = (e: MouseEvent) => {
|
|
69
|
-
const selectedText = window.getSelection()?.toString().trim();
|
|
70
|
-
if (isOpen && selectedText === position.text) return;
|
|
71
|
-
|
|
72
|
-
if (isMobile && selectedText) {
|
|
73
|
-
setPosition(calculateMobilePosition(selectedText, menuWidth));
|
|
74
|
-
} else {
|
|
75
|
-
setPosition({ x: e.clientX, y: e.clientY, text: selectedText });
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const handleMouseUp = (e: MouseEvent) => {
|
|
80
|
-
const selectedText = window.getSelection()?.toString().trim();
|
|
81
|
-
// Check if click is inside the context menu
|
|
82
|
-
if (menuRef.current && menuRef.current.contains(e.target as Node)) {
|
|
83
|
-
// Don't close the menu if clicking inside
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Prevent context menu on textarea or text input selection
|
|
88
|
-
const target = e.target as HTMLElement;
|
|
89
|
-
const isTextInput =
|
|
90
|
-
target &&
|
|
91
|
-
(target.tagName === 'TEXTAREA' || (target.tagName === 'INPUT' && (target as HTMLInputElement).type === 'text'));
|
|
92
|
-
if (isTextInput) {
|
|
93
|
-
setIsOpen(false);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (e.button === 0 && isOpen) {
|
|
98
|
-
setIsOpen(false);
|
|
99
|
-
window.getSelection()?.removeAllRanges();
|
|
100
|
-
} else if (selectedText && (openOnTextSelect || e.button === 2)) {
|
|
101
|
-
if (e.button === 2) {
|
|
102
|
-
e.preventDefault();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (isMobile) {
|
|
106
|
-
setPosition(calculateMobilePosition(selectedText, menuWidth));
|
|
107
|
-
} else {
|
|
108
|
-
setPosition({ x: e.clientX, y: e.clientY, text: selectedText });
|
|
109
|
-
}
|
|
110
|
-
setIsOpen(true);
|
|
111
|
-
} else {
|
|
112
|
-
setIsOpen(false);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// Add selectionchange listener to close menu if selection is cleared and update position for mobile
|
|
117
|
-
const handleSelectionChange = () => {
|
|
118
|
-
const selectedText = window.getSelection()?.toString().trim();
|
|
119
|
-
if (!selectedText && isOpen) {
|
|
120
|
-
setIsOpen(false);
|
|
121
|
-
} else if (selectedText && isOpen && isMobile) {
|
|
122
|
-
// Update position in real-time as text selection changes on mobile
|
|
123
|
-
setPosition(calculateMobilePosition(selectedText, menuWidth));
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
document.addEventListener('mouseup', handleMouseUp);
|
|
128
|
-
window.addEventListener('mousemove', handleMouseMove);
|
|
129
|
-
document.addEventListener('contextmenu', handleMouseUp);
|
|
130
|
-
document.addEventListener('selectionchange', handleSelectionChange);
|
|
131
|
-
|
|
132
|
-
return () => {
|
|
133
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
134
|
-
window.removeEventListener('mousemove', handleMouseMove);
|
|
135
|
-
document.removeEventListener('contextmenu', handleMouseUp);
|
|
136
|
-
document.removeEventListener('selectionchange', handleSelectionChange);
|
|
137
|
-
};
|
|
138
|
-
}, [openOnTextSelect, isOpen, position.text]);
|
|
139
|
-
|
|
140
|
-
if (!isOpen) {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<div
|
|
146
|
-
ref={menuRef}
|
|
147
|
-
className="fixed bg-gray-400 dark:bg-gray-700 shadow-lg border border-gray-400 rounded-md overflow-hidden dark:text-white z-50"
|
|
148
|
-
style={{ top: position.y, left: position.x }}
|
|
149
|
-
>
|
|
150
|
-
{actions.map((action, index) => (
|
|
151
|
-
<MenuEntryItem
|
|
152
|
-
key={index}
|
|
153
|
-
icon={action.icon}
|
|
154
|
-
text={action.text}
|
|
155
|
-
onClick={() => {
|
|
156
|
-
setIsOpen(false);
|
|
157
|
-
window.getSelection()?.removeAllRanges();
|
|
158
|
-
client.event.emitSidebarAction(action.plugin_id, action.action_key, position.text);
|
|
159
|
-
}}
|
|
160
|
-
/>
|
|
161
|
-
))}
|
|
162
|
-
</div>
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
function MenuEntryItem(props: { icon: React.ReactNode; text: string; onClick: () => void }) {
|
|
167
|
-
return (
|
|
168
|
-
<button
|
|
169
|
-
onClick={props.onClick}
|
|
170
|
-
className="px-4 py-2 text-left hover:bg-gray-500 dark:hover:bg-gray-600 w-full flex flex-row"
|
|
171
|
-
>
|
|
172
|
-
<span className="flex-grow">{props.icon}</span>
|
|
173
|
-
<span className="flex-grow">{props.text}</span>
|
|
174
|
-
{/* <span className="text-sm">Ctrl+Shift+xxxx</span> */}
|
|
175
|
-
</button>
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export default ContextMenu;
|
package/src/components.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// React components and hooks exports
|
|
2
|
-
export * from './components/ai/Assistant';
|
|
3
|
-
export * from './components/ai/Avatar';
|
|
4
|
-
export * from './components/ai/EmbeddedAssistent/VoiceRecoder';
|
|
5
|
-
export * from './components/audio/Playbutton';
|
|
6
|
-
export * from './components/CRUDModal';
|
|
7
|
-
export * from './components/MarkdownEditor';
|
|
8
|
-
export * from './components/Spinner';
|
|
9
|
-
export * from './hooks/UseChatHook';
|
|
10
|
-
export * from './plugin/ThemeSetter';
|
|
11
|
-
export * from './providers/PluginProvider';
|
package/src/core/core.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Core functionality exports
|
|
2
|
-
export * from '../fromRimori/PluginTypes';
|
|
3
|
-
export * from '../plugin/PluginController';
|
|
4
|
-
export * from '../plugin/RimoriClient';
|
|
5
|
-
export * from '../utils/difficultyConverter';
|
|
6
|
-
export * from '../utils/PluginUtils';
|
|
7
|
-
export * from '../worker/WorkerSetup';
|
|
8
|
-
export { EventBusMessage } from '../fromRimori/EventBus';
|
|
9
|
-
export { Buddy, UserInfo, Language } from './controller/SettingsController';
|
|
10
|
-
export { SharedContent } from './controller/SharedContentController';
|
|
11
|
-
export { Exercise, TriggerAction } from './controller/ExerciseController';
|
|
12
|
-
export { Message, OnLLMResponse, ToolInvocation } from './controller/AIController';
|
|
13
|
-
export { MacroAccomplishmentPayload, MicroAccomplishmentPayload } from '../plugin/AccomplishmentHandler';
|
|
14
|
-
export { Tool } from '../fromRimori/PluginTypes';
|
|
15
|
-
export { SharedContentObjectRequest } from './controller/SharedContentController';
|
package/src/hooks/I18nHooks.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { TOptions } from 'i18next';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { Translator } from '../plugin/TranslationController';
|
|
4
|
-
import { useRimori } from '../providers/PluginProvider';
|
|
5
|
-
|
|
6
|
-
type TranslatorFn = (key: string, options?: TOptions) => string;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Custom useTranslation hook that provides a translation function and indicates readiness
|
|
10
|
-
* @returns An object containing the translation function (`t`) and a boolean (`ready`) indicating if the translator is initialized.
|
|
11
|
-
*/
|
|
12
|
-
export function useTranslation(): { t: TranslatorFn; ready: boolean } {
|
|
13
|
-
const { plugin } = useRimori();
|
|
14
|
-
const [translatorInstance, setTranslatorInstance] = useState<Translator | null>(null);
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
void plugin.getTranslator().then(setTranslatorInstance);
|
|
18
|
-
}, [plugin]);
|
|
19
|
-
|
|
20
|
-
const safeT = (key: string, options?: TOptions): string => {
|
|
21
|
-
// return zero-width space if translator is not initialized to keep text space occupied
|
|
22
|
-
if (!translatorInstance) return '\u200B'; // zero-width space
|
|
23
|
-
|
|
24
|
-
const result = translatorInstance.t(key, options);
|
|
25
|
-
if (!result) {
|
|
26
|
-
console.error(`Translation key not found: ${key}`);
|
|
27
|
-
return '\u200B'; // zero-width space
|
|
28
|
-
}
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return { t: safeT, ready: translatorInstance !== null };
|
|
33
|
-
}
|
package/src/hooks/UseChatHook.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Tool } from '../fromRimori/PluginTypes';
|
|
3
|
-
import { useRimori } from '../providers/PluginProvider';
|
|
4
|
-
import { Message, ToolInvocation } from '../core/controller/AIController';
|
|
5
|
-
|
|
6
|
-
export function useChat(tools?: Tool[]) {
|
|
7
|
-
const [messages, setMessages] = React.useState<Message[]>([]);
|
|
8
|
-
const [isLoading, setIsLoading] = React.useState(false);
|
|
9
|
-
const { ai } = useRimori();
|
|
10
|
-
|
|
11
|
-
const append = (appendMessages: Message[]) => {
|
|
12
|
-
const allMessages = [...messages, ...appendMessages];
|
|
13
|
-
setMessages(allMessages);
|
|
14
|
-
ai.getSteamedText(
|
|
15
|
-
allMessages,
|
|
16
|
-
(id, message, finished: boolean, toolInvocations?: ToolInvocation[]) => {
|
|
17
|
-
const lastMessage = messages[messages.length - 1];
|
|
18
|
-
setIsLoading(!finished);
|
|
19
|
-
|
|
20
|
-
if (lastMessage?.id === id) {
|
|
21
|
-
lastMessage.content = message;
|
|
22
|
-
setMessages([...messages, lastMessage]);
|
|
23
|
-
} else {
|
|
24
|
-
setMessages([...allMessages, { id, role: 'assistant', content: message, toolCalls: toolInvocations }]);
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
tools,
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
messages,
|
|
33
|
-
append,
|
|
34
|
-
isLoading,
|
|
35
|
-
setMessages,
|
|
36
|
-
lastMessage: messages[messages.length - 1] as Message | undefined,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export function setTheme(theme?: string | null) {
|
|
2
|
-
document.documentElement.classList.add('dark:text-gray-200');
|
|
3
|
-
|
|
4
|
-
if (isDarkTheme(theme)) {
|
|
5
|
-
document.documentElement.setAttribute('data-theme', 'dark');
|
|
6
|
-
document.documentElement.classList.add('dark', 'dark:bg-gray-950');
|
|
7
|
-
document.documentElement.style.background = 'hsl(var(--background))';
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function isDarkTheme(theme?: string | null): boolean {
|
|
12
|
-
// If no theme provided, try to get from URL as fallback (for standalone mode)
|
|
13
|
-
if (!theme) {
|
|
14
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
15
|
-
theme = urlParams.get('theme');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (!theme || theme === 'system') {
|
|
19
|
-
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return theme === 'dark';
|
|
23
|
-
}
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import React, { createContext, useContext, ReactNode, useEffect, useState } from 'react';
|
|
2
|
-
import { PluginController } from '../plugin/PluginController';
|
|
3
|
-
import { RimoriClient } from '../plugin/RimoriClient';
|
|
4
|
-
import { EventBusHandler } from '../fromRimori/EventBus';
|
|
5
|
-
import ContextMenu from '../components/components/ContextMenu';
|
|
6
|
-
import { StandaloneClient } from '../plugin/StandaloneClient';
|
|
7
|
-
|
|
8
|
-
interface PluginProviderProps {
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
pluginId: string;
|
|
11
|
-
settings?: {
|
|
12
|
-
disableContextMenu?: boolean;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const PluginContext = createContext<RimoriClient | null>(null);
|
|
17
|
-
|
|
18
|
-
export const PluginProvider: React.FC<PluginProviderProps> = ({ children, pluginId, settings }) => {
|
|
19
|
-
const [plugin, setPlugin] = useState<RimoriClient | null>(null);
|
|
20
|
-
const [standaloneClient, setStandaloneClient] = useState<StandaloneClient | boolean>(false);
|
|
21
|
-
const [applicationMode, setApplicationMode] = useState<string | null>(null);
|
|
22
|
-
const [theme, setTheme] = useState<string | null>(null);
|
|
23
|
-
|
|
24
|
-
const isSidebar = applicationMode === 'sidebar';
|
|
25
|
-
const isSettings = applicationMode === 'settings';
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
initEventBus(pluginId);
|
|
29
|
-
|
|
30
|
-
// Check if we're in an iframe context - if not, we're standalone
|
|
31
|
-
const standaloneDetected = window === window.parent;
|
|
32
|
-
|
|
33
|
-
if (standaloneDetected && !standaloneClient) {
|
|
34
|
-
StandaloneClient.getInstance().then((client) => {
|
|
35
|
-
client.needsLogin().then((needLogin) => setStandaloneClient(needLogin ? client : true));
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if ((!standaloneDetected && !plugin) || (standaloneDetected && standaloneClient === true)) {
|
|
40
|
-
PluginController.getInstance(pluginId, standaloneDetected).then((client) => {
|
|
41
|
-
setPlugin(client);
|
|
42
|
-
// Get applicationMode and theme from MessageChannel query params
|
|
43
|
-
if (!standaloneDetected) {
|
|
44
|
-
const mode = client.getQueryParam('applicationMode');
|
|
45
|
-
const themeParam = client.getQueryParam('rm_theme');
|
|
46
|
-
setApplicationMode(mode);
|
|
47
|
-
setTheme(themeParam);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}, [pluginId, standaloneClient]);
|
|
52
|
-
|
|
53
|
-
//route change
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (!plugin) return;
|
|
56
|
-
|
|
57
|
-
//sidebar pages should not report url changes
|
|
58
|
-
if (isSidebar) return;
|
|
59
|
-
|
|
60
|
-
let lastHash = window.location.hash;
|
|
61
|
-
const emitUrlChange = (url: string) => plugin.event.emit('session.triggerUrlChange', { url });
|
|
62
|
-
|
|
63
|
-
const interval = setInterval(() => {
|
|
64
|
-
if (lastHash === window.location.hash) return;
|
|
65
|
-
lastHash = window.location.hash;
|
|
66
|
-
// console.log('url changed:', lastHash);
|
|
67
|
-
emitUrlChange(lastHash);
|
|
68
|
-
}, 1000);
|
|
69
|
-
|
|
70
|
-
emitUrlChange(lastHash);
|
|
71
|
-
return () => clearInterval(interval);
|
|
72
|
-
}, [plugin]);
|
|
73
|
-
|
|
74
|
-
//detect page height change
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
const body = document.body;
|
|
77
|
-
const handleResize = () => plugin?.event.emit('session.triggerHeightChange', body.clientHeight);
|
|
78
|
-
body.addEventListener('resize', handleResize);
|
|
79
|
-
handleResize();
|
|
80
|
-
return () => body.removeEventListener('resize', handleResize);
|
|
81
|
-
}, [plugin]);
|
|
82
|
-
|
|
83
|
-
if (standaloneClient instanceof StandaloneClient) {
|
|
84
|
-
return (
|
|
85
|
-
<StandaloneAuth
|
|
86
|
-
onLogin={async (email, password) => {
|
|
87
|
-
if (await standaloneClient.login(email, password)) setStandaloneClient(true);
|
|
88
|
-
}}
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (!plugin) {
|
|
94
|
-
return '';
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<PluginContext.Provider value={plugin}>
|
|
99
|
-
{!settings?.disableContextMenu && !isSidebar && !isSettings && <ContextMenu client={plugin} />}
|
|
100
|
-
{children}
|
|
101
|
-
</PluginContext.Provider>
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export const useRimori = () => {
|
|
106
|
-
const context = useContext(PluginContext);
|
|
107
|
-
if (context === null) {
|
|
108
|
-
throw new Error('useRimori must be used within an PluginProvider');
|
|
109
|
-
}
|
|
110
|
-
return context;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
function getUrlParam(name: string) {
|
|
114
|
-
// First try to get from URL hash query params (for compatibility)
|
|
115
|
-
const hashParts = window.location.hash.split('?');
|
|
116
|
-
if (hashParts.length > 1) {
|
|
117
|
-
const hashParams = new URLSearchParams(hashParts[1]);
|
|
118
|
-
const hashValue = hashParams.get(name);
|
|
119
|
-
if (hashValue) return hashValue;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Fallback to regular URL search params
|
|
123
|
-
const url = new URL(window.location.href);
|
|
124
|
-
return url.searchParams.get(name);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function initEventBus(pluginId: string) {
|
|
128
|
-
// For now, use URL fallback for EventBus naming - this will be updated once MessageChannel is ready
|
|
129
|
-
const isSidebar = getUrlParam('applicationMode') === 'sidebar';
|
|
130
|
-
EventBusHandler.getInstance('Plugin EventBus ' + pluginId + ' ' + (isSidebar ? 'sidebar' : 'main'));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function StandaloneAuth({ onLogin }: { onLogin: (user: string, password: string) => void }) {
|
|
134
|
-
const [user, setUser] = useState('');
|
|
135
|
-
const [password, setPassword] = useState('');
|
|
136
|
-
return (
|
|
137
|
-
<div
|
|
138
|
-
style={{
|
|
139
|
-
position: 'fixed',
|
|
140
|
-
inset: 0,
|
|
141
|
-
display: 'flex',
|
|
142
|
-
alignItems: 'center',
|
|
143
|
-
justifyContent: 'center',
|
|
144
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
145
|
-
}}
|
|
146
|
-
>
|
|
147
|
-
<div
|
|
148
|
-
style={{
|
|
149
|
-
backgroundColor: '#343534',
|
|
150
|
-
padding: '1rem',
|
|
151
|
-
borderRadius: '0.5rem',
|
|
152
|
-
width: '500px',
|
|
153
|
-
flexDirection: 'column',
|
|
154
|
-
display: 'flex',
|
|
155
|
-
alignItems: 'center',
|
|
156
|
-
justifyContent: 'center',
|
|
157
|
-
}}
|
|
158
|
-
>
|
|
159
|
-
<p style={{ fontSize: '2rem', fontWeight: 'bold', marginBottom: '1rem', textAlign: 'center' }}>Rimori Login</p>
|
|
160
|
-
<p style={{ marginBottom: '1rem', textAlign: 'center' }}>
|
|
161
|
-
Please login with your Rimori developer account for this plugin to be able to access the Rimori platform the
|
|
162
|
-
same it will operate in the Rimori platform.
|
|
163
|
-
</p>
|
|
164
|
-
{/* email and password input */}
|
|
165
|
-
<input
|
|
166
|
-
style={{
|
|
167
|
-
marginBottom: '1rem',
|
|
168
|
-
width: '100%',
|
|
169
|
-
padding: '0.5rem',
|
|
170
|
-
borderRadius: '0.5rem',
|
|
171
|
-
border: 'none',
|
|
172
|
-
backgroundColor: '#444444',
|
|
173
|
-
}}
|
|
174
|
-
type="email"
|
|
175
|
-
placeholder="Email"
|
|
176
|
-
onChange={(e) => setUser(e.target.value)}
|
|
177
|
-
/>
|
|
178
|
-
<input
|
|
179
|
-
style={{
|
|
180
|
-
marginBottom: '1rem',
|
|
181
|
-
width: '100%',
|
|
182
|
-
padding: '0.5rem',
|
|
183
|
-
borderRadius: '0.5rem',
|
|
184
|
-
border: 'none',
|
|
185
|
-
backgroundColor: '#444444',
|
|
186
|
-
}}
|
|
187
|
-
type="password"
|
|
188
|
-
placeholder="Password"
|
|
189
|
-
onChange={(e) => setPassword(e.target.value)}
|
|
190
|
-
/>
|
|
191
|
-
<button
|
|
192
|
-
style={{
|
|
193
|
-
marginBottom: '1rem',
|
|
194
|
-
width: '100%',
|
|
195
|
-
padding: '0.5rem',
|
|
196
|
-
borderRadius: '0.5rem',
|
|
197
|
-
border: 'none',
|
|
198
|
-
backgroundColor: '#928358',
|
|
199
|
-
}}
|
|
200
|
-
onClick={() => {
|
|
201
|
-
onLogin(user, password);
|
|
202
|
-
}}
|
|
203
|
-
>
|
|
204
|
-
Login
|
|
205
|
-
</button>
|
|
206
|
-
</div>
|
|
207
|
-
</div>
|
|
208
|
-
);
|
|
209
|
-
}
|