Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop

This commit is contained in:
Seth Call 2024-09-29 11:24:51 -05:00
commit eea46feb5d
12 changed files with 641 additions and 478 deletions

View File

@ -80,9 +80,10 @@ const LoginForm = ({ setRedirect, hasLabel, layout }) => {
/>
</Col>
<Col xs="auto">
<Link className="fs--1" to={`/authentication/${layout}/forget-password`}>
{/* <Link className="fs--1" to={`/authentication/${layout}/forget-password`}>
Forget Password?
</Link>
</Link> */}
<a href="https://www.jamkazam.com/request_reset_password" target='_blank'>Forgot Password</a>
</Col>
</Row>
<FormGroup>

View File

@ -22,7 +22,10 @@ import { truncate } from '../../helpers/utils';
import HomePage from '../page/JKHomePage';
import JKHelp from '../page/JKHelp';
import JKHelp from '../help/JKHelp';
import JKKnowledgeBase from '../help/JKKnowledgeBase';
import JKHelpDesk from '../help/JKHelpDesk';
import JKForum from '../help/JKForum';
import JKPrivacy from '../page/JKPrivacy';
//import JKPeople from '../page/JKPeople';
import JKPeopleFilter from '../page/JKPeopleFilter';
@ -273,6 +276,9 @@ function JKDashboardMain() {
<Switch>
<Route path="/privacy" component={JKPrivacy} />
<Route path="/help" component={JKHelp} />
<Route path="/knowledge-base" component={JKKnowledgeBase} />
<Route path="/help-desk" component={JKHelpDesk} />
<Route path="/forum" component={JKForum} />
<Route path="/unsubscribe" exact component={JKUnsubscribe} />
{/* <PrivateRoute path="/" exact component={HomePage} /> */}
<PrivateRoute path="/" exact component={JKEditProfile} />

View File

@ -0,0 +1,18 @@
import React, {useEffect} from 'react'
const JKForum = () => {
const pageUrl = "https://forum.jamkazam.com/"
useEffect(() => {
window.open(pageUrl, '_blank').focus();
window.history.go(-1)
return () => {
};
}, [])
return (
<div>
opening...
</div>
)
}
export default JKForum

View File

@ -0,0 +1,18 @@
import React, {useEffect} from 'react'
const JKHelp = () => {
const pageUrl = "https://www.jamkazam.com/corp/help"
useEffect(() => {
window.open(pageUrl, '_blank').focus();
window.history.go(-1)
return () => {
};
}, [])
return (
<div>
opening...
</div>
)
}
export default JKHelp;

View File

@ -0,0 +1,18 @@
import React, {useEffect} from 'react'
const JKHelpDesk = () => {
const pageUrl = "https://www.jamkazam.com/help_desk"
useEffect(() => {
window.open(pageUrl, '_blank').focus();
window.history.go(-1)
return () => {
};
}, [])
return (
<div>
opening...
</div>
)
}
export default JKHelpDesk

View File

@ -0,0 +1,18 @@
import React, {useEffect} from 'react'
const JKKnowledgeBase = () => {
const pageUrl = "https://jamkazam.freshdesk.com/support/home"
useEffect(() => {
window.open(pageUrl, '_blank').focus();
window.history.go(-1)
return () => {
};
}, [])
return (
<div>
opening...
</div>
)
}
export default JKKnowledgeBase

View File

@ -10,16 +10,23 @@ import { getInstruments, getGenres, updateUser, getCountries, getRegions, getCit
import JKProfileAvatarUpload from '../profile/JKProfileAvatarUpload';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Prompt } from 'react-router';
// import useUserProfile from '../../hooks/useUserProfile';
import { useAppData } from '../../context/AppDataContext';
function JKEditProfile() {
const { t } = useTranslation('profile');
const { currentUser } = useAuth();
const [musicInstruments, setMusicInstruments] = useState([]);
const [userMusicInstruments, setUserMusicInstruments] = useState([]);
const [userMusicInstrumentsReceived, setUserMusicInstrumentsReceived] = useState(false);
const [genres, setGenres] = useState([]);
const [userGenres, setUserGenres] = useState([]);
const [userGenresReceived, setUserGenresReceived] = useState(false);
const [instrumentsInitialLoadingDone, setInstrumentsInitialLoadingDone] = useState(false);
const [genreInitialLoadingDone, setGenreInitialLoadingDone] = useState(false);
const [countries, setCountries] = useState([]);
const [regions, setRegions] = useState([]);
const [cities, setCities] = useState([]);
@ -60,11 +67,15 @@ function JKEditProfile() {
});
useEffect(() => {
if (!userProfile) return;
if (!userProfile || Object.keys(userProfile).length === 0) return;
updateFormData(userProfile);
setUserGenres(userProfile.genres);
setUserGenresReceived(true);
setUserMusicInstruments(userProfile.instruments);
setUserMusicInstrumentsReceived(true);
}, [userProfile]);
useEffect(() => {
useLayoutEffect(() => {
fetchInstruments();
fetchGenres();
fetchCountries();
@ -105,8 +116,8 @@ function JKEditProfile() {
};
useEffect(() => {
if (!musicInstruments.length || !getValues('instruments') || instrumentsInitialLoadingDone) return;
setInstrumentsInitialLoadingDone(false);
if (instrumentsInitialLoadingDone || musicInstruments.length === 0 || !userMusicInstrumentsReceived) return;
const updatedMusicInstruments = musicInstruments.map(musicInstrument => {
const instrument = getValues('instruments').find(instrument => instrument.instrument_id === musicInstrument.id);
@ -125,7 +136,7 @@ function JKEditProfile() {
});
setMusicInstruments(updatedMusicInstruments);
setInstrumentsInitialLoadingDone(true);
}, [musicInstruments, getValues('instruments')]);
}, [userMusicInstrumentsReceived, musicInstruments]);
const fetchGenres = () => {
getGenres()
@ -143,9 +154,10 @@ function JKEditProfile() {
};
useEffect(() => {
if (!genres.length || !getValues('genres') || genreInitialLoadingDone) return;
if (genreInitialLoadingDone || genres.length === 0 || !userGenresReceived) return;
const updatedGenres = genres.map(genre => {
const userGenre = getValues('genres').find(userGenre => userGenre.genre_id === genre.id);
const userGenre = userGenres.find(userGenre => userGenre.genre_id === genre.id);
if (userGenre) {
genre.checked = true;
} else {
@ -156,7 +168,7 @@ function JKEditProfile() {
});
setGenres(updatedGenres);
setGenreInitialLoadingDone(true);
}, [genres, getValues('genres')]);
}, [userGenresReceived, genres]);
const fetchCountries = () => {
getCountries()
@ -261,6 +273,7 @@ function JKEditProfile() {
};
const handleGenreChange = (e, genre) => {
if (e.target.checked) {
const userGenres = getValues('genres');
const thisGenre = userGenres.find(userGenre => userGenre.genre_id === genre.genre_id);
@ -273,6 +286,7 @@ function JKEditProfile() {
}
const updatedGenres = genres.map(genreItem => {
console.log('genreItem', genreItem, genre);
if (genreItem.genre_id === genre.genre_id) {
genreItem.checked = e.target.checked;
} else {
@ -672,46 +686,45 @@ function JKEditProfile() {
</Card>
</Col>
<Col sm="12" md="6">
<Card className="mt-3 mt-md-0">
<Card className="mt-3 mt-md-0">
<CardHeader>
<h5>{t('instruments')}</h5>
</CardHeader>
<CardBody data-testid="instruments" className="bg-light" style={{ overflowY: 'scroll', height: 300 }}>
<FormGroup check>
{instrumentsInitialLoadingDone &&
musicInstruments.map((musicInstrument, index) => {
return (
<Row key={musicInstrument.id} className="mb-1">
<Col md={5}>
<Input
onChange={e => {
handleInstrumentSelect(e, musicInstrument);
}}
type="checkbox"
checked={musicInstrument.checked}
/>
{musicInstruments.map(musicInstrument => {
return (
<Row key={musicInstrument.id} className="mb-1">
<Col md={5}>
<Input
onChange={e => {
handleInstrumentSelect(e, musicInstrument);
}}
type="checkbox"
checked={musicInstrument.checked}
/>
<Label check for="check">
{musicInstrument.description}
</Label>
</Col>
<Col md={7}>
<Select
value={
musicInstrument.checked
? PROFICIENCIES.find(p => parseInt(p.value) === musicInstrument.proficiency_level)
: null
}
onChange={e => {
handleInstrumentProficiencyChange(e, musicInstrument);
}}
options={PROFICIENCIES}
isDisabled={!musicInstrument.checked}
/>
</Col>
</Row>
);
})}
<Label check for="check">
{musicInstrument.description}
</Label>
</Col>
<Col md={7}>
<Select
value={
musicInstrument.checked
? PROFICIENCIES.find(p => parseInt(p.value) === musicInstrument.proficiency_level)
: null
}
onChange={e => {
handleInstrumentProficiencyChange(e, musicInstrument);
}}
options={PROFICIENCIES}
isDisabled={!musicInstrument.checked}
/>
</Col>
</Row>
);
})}
</FormGroup>
</CardBody>
</Card>
@ -721,28 +734,28 @@ function JKEditProfile() {
</CardHeader>
<CardBody data-testid="genres" className="bg-light" style={{ overflowY: 'scroll', height: 300 }}>
<FormGroup check>
{genreInitialLoadingDone &&
genres.map((genre, index) => {
return (
<Row key={genre.genre_id}>
<Col md={4}>
<Input
onChange={e => {
handleGenreChange(e, genre);
}}
type="checkbox"
checked={genre.checked}
/>
<Label check for="check">
{genre.description}
</Label>
</Col>
</Row>
);
})}
{genres.map(genre => {
return (
<Row key={genre.genre_id}>
<Col md={4}>
<Input
onChange={e => {
handleGenreChange(e, genre);
}}
type="checkbox"
checked={genre.checked}
/>
<Label check for="check">
{genre.description}
</Label>
</Col>
</Row>
);
})}
</FormGroup>
</CardBody>
</Card>
</Col>
</Row>
</Form>

View File

@ -1,16 +0,0 @@
import React, {useEffect} from 'react'
const JKHelp = () => {
useEffect(() => {
window.location.href = `${process.env.REACT_APP_CLIENT_BASE_URL}/help_desk`
return () => {
};
}, [])
return (
<div>
redirecting...
</div>
)
}
export default JKHelp;

View File

@ -83,8 +83,8 @@ export const helpRoutes = {
exact: true,
icon: 'question-circle',
children: [
{ to: '/knowladge', name: 'Knowladge Base' },
{ to: '/helpdesk', name: 'Help Desk'},
{ to: '/knowledge-base', name: 'Knowledge Base' },
{ to: '/help-desk', name: 'Help Desk'},
{ to: '/forum', name: 'Forum'}
]

View File

@ -263,6 +263,7 @@
// called from sidebar when messages come in
function messageReceived(payload) {
alert("messageReceived");
if(showing && otherId == payload.sender_id) {
if(fullyInitialized) {
renderMessage(payload.msg, payload.sender_id, payload.sender_name, payload.created_at, true);

File diff suppressed because it is too large Load Diff

View File

@ -95,8 +95,7 @@ class ApiUsersController < ApiController
@profile = User.includes([{musician_instruments: :instrument},
{band_musicians: :user},
{genre_players: :genre},
:bands, :instruments, :genres,
:online_presences, :performance_samples])
:bands, :online_presences, :performance_samples])
.find(params[:id])
@show_teacher_profile = params[:show_teacher]