Skip to content

Commit

Permalink
resolved conficts
Browse files Browse the repository at this point in the history
  • Loading branch information
danielc-n committed Apr 26, 2024
2 parents 77b7d4a + be223cc commit d1b7193
Show file tree
Hide file tree
Showing 18 changed files with 1,253 additions and 333 deletions.
4 changes: 3 additions & 1 deletion e2e-tests/myFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ type myFixture = {
english: string,
hindi: string,
russian: string,
farsi: string
farsi: string,
arabic: string
}
const myFixtureTest = myTest.extend<myFixture>({
userName: "Playwright user",
Expand Down Expand Up @@ -60,6 +61,7 @@ const myFixtureTest = myTest.extend<myFixture>({
hindi: "Hindi",
russian: "Russian",
farsi: "Farsi",
arabic: "Arabic",
textUnderscore: "Translation_test_project",
obsUnderscore: "Obs_test_project",
syncName: "Sync_Collab_Test",
Expand Down
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@
"@supabase/supabase-js": "^2.26.0",
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/typography": "^0.5.9",
"@testing-library/jest-dom": "^6.1.3",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.5.1",
"@types/jest": "^29.5.5",
"@types/node": "^20.8.2",
"@types/react": "^18.2.25",
Expand Down Expand Up @@ -219,8 +216,7 @@
"usfm-editor": "0.8.7",
"usfm-grammar": "^2.3.0",
"uuid": "^8.3.2",
"wavesurfer.js": "^6.6.2",
"web-vitals": "^3.5.0",
"wavesurfer.js": "^6.6.4",
"webpack-node-externals": "^3.0.0",
"winston": "^3.7.2",
"word-aligner": "1.0.0",
Expand All @@ -242,7 +238,6 @@
},
"optionalDependencies": {
"bufferutil": "^4.0.6",
"react-icons": "4.10.1",
"scripture-resources-rcl": "5.1.0",
"utf-8-validate": "^5.0.9"
},
Expand All @@ -254,4 +249,4 @@
"word-aligner": "$word-aligner",
"@mui/lab": "$@mui/lab"
}
}
}
57 changes: 49 additions & 8 deletions renderer/src/components/AudioRecorder/components/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,30 @@ const Player = ({
const [currentSpeed, setCurrentSpeed] = useState(1);
const speed = [0.5, 1, 1.5, 2];
const path = require('path');
const [time, setTime] = useState(0);
const [playTime, setPlayTime] = useState(0);
// state to check stopwatch running or not
const [isRunning, setIsRunning] = useState(false);

useEffect(() => {
let intervalId;
if (isRunning) {
// setting time from 0 to 1 every 10 milisecond using javascript setInterval method
intervalId = setInterval(() => setTime(time + 1), 10);
}
return () => clearInterval(intervalId);
}, [isRunning, time]);

// playTime is the total time of audio & time is recording time
// Minutes calculation
const minutes = playTime > 0 ? Math.floor(playTime / 60) : (time > 0 ? Math.floor((time % 360000) / 6000) : 0);

// Seconds calculation
const seconds = playTime > 0 ? Math.floor(playTime % 60) : (time > 0 ? Math.floor((time % 6000) / 100) : 0);

// Milliseconds calculation
const milliseconds = playTime > 0 ? Math.floor((playTime - Math.floor(playTime)) * 100) : (time > 0 ? time % 100 : 0);

const handleRecord = () => {
// check whether its a first record or re-recording
if (url[take]) {
Expand All @@ -52,6 +76,8 @@ const Player = ({
} else {
// Recording for the first time
setTrigger('record');
setTime(0);
setIsRunning(true);
}
};
const handleDelete = () => {
Expand Down Expand Up @@ -177,6 +203,20 @@ const Player = ({
</Listbox.Options>
</Listbox>
</div>
<div className="flex flex-col px-10 items-center border-r border-r-gray-800">
<div className="flex flex-col items-center text-xl">
<div className="text-xs text-gray-300 uppercase tracking-wider">
m:s:ms
</div>
<div>
{minutes.toString().padStart(2, '0')}
:
{seconds.toString().padStart(2, '0')}
:
{milliseconds.toString().padStart(2, '0')}
</div>
</div>
</div>
<div className="flex flex-row items-center justify-evenly border-r border-r-gray-800">
<div className="flex flex-col items-center">
{((trigger === 'record' || trigger === 'recResume') && (
Expand All @@ -188,7 +228,7 @@ const Player = ({
type="button"
title="P"
className="p-2 bg-error rounded-md hover:bg-dark"
onClick={() => setTrigger('recPause')}
onClick={() => { setTrigger('recPause'); setIsRunning(false); }}
>
<PauseIcon
fill="currentColor"
Expand All @@ -207,7 +247,7 @@ const Player = ({
type="button"
title="E"
className="p-2 bg-dark rounded-md hover:bg-error"
onClick={() => setTrigger('recResume')}
onClick={() => { setTrigger('recResume'); setIsRunning(true); }}
>
<PlayIcon
fill="currentColor"
Expand Down Expand Up @@ -244,7 +284,7 @@ const Player = ({
type="button"
title="S"
className="p-2 bg-dark rounded-md hover:bg-primary"
onClick={() => setTrigger('recStop')}
onClick={() => { setTrigger('recStop'); setIsRunning(false); }}
>
<StopIcon
fill="currentColor"
Expand All @@ -263,7 +303,7 @@ const Player = ({
type="button"
title="<"
className="p-2 bg-dark rounded-md hover:bg-error"
onClick={() => setTrigger('rewind')}
onClick={() => { setTrigger('rewind'); setTime(0); setPlayTime(0); }}
>
<ArrowPathIcon
className="w-5 h-5"
Expand Down Expand Up @@ -343,7 +383,7 @@ const Player = ({
</button>
<input
type="range"
className="md:w-12 w-full xl:w-44"
className="md:w-12 w-full xl:w-44 accent-primary"
min={0}
max={1}
step={0.1}
Expand Down Expand Up @@ -385,7 +425,7 @@ const Player = ({
} text-xs font-bold ${
url?.take1 ? 'text-white' : 'text-black'
} uppercase tracking-wider rounded-full`}
onClick={() => changeTake('take1')}
onClick={() => { changeTake('take1'); setTime(0); setPlayTime(0); }}
title="select : A"
onDoubleClick={() => changeDefault(1)}
>
Expand All @@ -406,7 +446,7 @@ const Player = ({
} text-xs font-bold ${
url?.take2 ? 'text-white' : 'text-black'
} uppercase tracking-wider rounded-full`}
onClick={() => changeTake('take2')}
onClick={() => { changeTake('take2'); setTime(0); setPlayTime(0); }}
title="select : B"
onDoubleClick={() => changeDefault(2)}
>
Expand All @@ -427,7 +467,7 @@ const Player = ({
} text-xs font-bold ${
url?.take3 ? 'text-white' : 'text-black'
} uppercase tracking-wider rounded-full`}
onClick={() => changeTake('take3')}
onClick={() => { changeTake('take3'); setTime(0); setPlayTime(0); }}
title="select : C"
onDoubleClick={() => changeDefault(3)}
>
Expand Down Expand Up @@ -474,6 +514,7 @@ const Player = ({
speed={currentSpeed}
show={false}
setTrigger={setTrigger}
setAudioPlayBack={setPlayTime}
/>
</div>
</div>
Expand Down
19 changes: 19 additions & 0 deletions renderer/src/components/AudioRecorder/components/WaveForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const AudioWaveForm = (props) => {
barGap,
barWidth,
barRadius,
setAudioPlayBack,
} = props;

const waveformRef = useRef(null);
Expand Down Expand Up @@ -65,6 +66,22 @@ const AudioWaveForm = (props) => {
wavesurfer.current?.load(currentUrl);
// wavesurfer.current?.setVolume(volume);
wavesurfer.current?.setPlaybackRate(speed);
wavesurfer.current.on('ready', () => {
const duration = wavesurfer?.current?.getDuration();
if (duration && duration !== Infinity) {
setAudioPlayBack(duration);
} else {
setAudioPlayBack(0);
}
});

wavesurfer.current.on('audioprocess', (time) => {
setAudioPlayBack(time);
});

wavesurfer.current.on('seeking', (time) => {
setAudioPlayBack(time);
});
};

const createRecForm = async () => {
Expand All @@ -88,6 +105,7 @@ const AudioWaveForm = (props) => {
if (wavesurfer.current) {
wavesurfer.current.destroy();
wavesurfer.current.microphone.destroy();
setAudioPlayBack(0);
}
};
}
Expand Down Expand Up @@ -236,4 +254,5 @@ AudioWaveForm.propTypes = {
resumeRecording: PropTypes.func,
setTrigger: PropTypes.func,
interaction: PropTypes.bool,
setAudioPlayBack: PropTypes.any,
};
8 changes: 5 additions & 3 deletions renderer/src/components/Login/LeftLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,14 @@ const LeftLogin = () => {
};
function formSubmit(event) {
event.preventDefault();
if (values.username.length < 3 || values.username.length > 15) {
const newValue = values;
newValue.username = newValue.username.trim();
if (newValue.username.length < 3 || newValue.username.length > 15) {
displayError('The input has to be between 3 and 15 characters long');
} else if (users.length > 0 && users.find((item) => (item.username.toLowerCase() === values.username.toLowerCase().trim()))) {
} else if (users.length > 0 && users.find((item) => (item.username.toLowerCase() === newValue.username.toLowerCase()))) {
displayError('User exists, Check archived and active tab by click on view more.');
} else {
handleSubmit(values);
handleSubmit(newValue);
setValues({});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD
// initial load
switch (selectResource) {
case 'bible':
url = `${baseUrl}&subject=Bible&lang=en`;
url = `${baseUrl}&lang=en&subject=${subjectTypeArray.bible[0].name}`;
// setSelectedTypeFilter([subjectTypeArray.bible[0]]);
break;
case 'obs':
url = `${baseUrl}&subject=${subjectTypeArray.obs[0].name}&lang=en`;
Expand Down Expand Up @@ -284,6 +285,7 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD

useEffect(() => {
logger.debug('DownloadResourcePopUp.js', 'in useEffect initial load of resource');
setSelectedTypeFilter([]);
fetchResource(false);
// setLoading(true)
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down Expand Up @@ -322,7 +324,7 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD
/>
</button>
<div className="flex flex-wrap gap-2 mt-2 mb-2">
{selectedLangFilter.map((language, idx) => (
{selectedLangFilter?.map((language, idx) => (
<div
key={idx}
className="flex items-center justify-center gap-2 px-3 py-1 bg-gray-200 rounded-full"
Expand All @@ -341,13 +343,13 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD
<CustomMultiComboBox
selectedList={selectedTypeFilter}
setSelectedList={setSelectedTypeFilter}
customData={selectResource === 'bible' ? subjectTypeArray.bible : subjectTypeArray.obs}
customData={selectResource === 'bible' ? subjectTypeArray.bible : [subjectTypeArray.obs]}
placeholder="Select Types"
dropArrow
multiSelect
/>
<div className="flex flex-wrap gap-2 mt-2 mb-2">
{ selectResource === 'bible' && selectedTypeFilter?.map((type, idx) => (
{ selectResource === 'bible' && Array.isArray(selectedTypeFilter) && selectedTypeFilter?.map((type, idx) => (
<div
key={idx}
className="flex items-center justify-center gap-2 px-3 py-1 bg-gray-200 rounded-full"
Expand Down Expand Up @@ -385,7 +387,7 @@ function DownloadResourcePopUp({ selectResource, isOpenDonwloadPopUp, setIsOpenD
className="bg-success leading-loose rounded shadow text-xs px-2 font-base text-white tracking-wide uppercase"
onClick={handleSaveFilter}
>
{t('label-save-filter')}
{t('label-filter')}
</button>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions renderer/src/modules/projects/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const languages = [
{ title: 'Farsi', code: 'fa' },
{ title: 'French', code: 'fr' },
{ title: 'Nepali', code: 'ne' },
{ title: 'Arabic', code: 'ar' },
];

function ProgressCircle({ isFilled, count, text }) {
Expand Down
Loading

0 comments on commit d1b7193

Please sign in to comment.