ui related improvements and fixes

This commit is contained in:
Nuwan 2022-01-11 16:19:39 +05:30
parent c0b9b66b9d
commit 7f4947a590
29 changed files with 137 additions and 72 deletions

View File

@ -44,7 +44,11 @@
"online_presences": [
{ "id": "e1962204-f652-41b0-84d6-1afd7e9172be", "service_type": "soundcloud", "username": "testuser" },
{ "id": "005a7c78-db8b-4f72-a51f-d64d579c22b0", "service_type": "reverbnation", "username": "testuser" },
{ "id": "2dd22eef-03ba-4743-b65b-5a194591dc86", "service_type": "bandcamp", "username": "testuser" }
{ "id": "2dd22eef-03ba-4743-b65b-5a194591dc86", "service_type": "bandcamp", "username": "testuser" },
{ "id": "005a7c78-db8b-4f72-a51f-d64d579c22b1", "service_type": "fandalism", "username": "testuser" },
{ "id": "005a7c78-db8b-4f72-a51f-d64d579c22b2", "service_type": "youtube", "username": "testuser" },
{ "id": "005a7c78-db8b-4f72-a51f-d64d579c22b3", "service_type": "facebook", "username": "testuser" },
{ "id": "005a7c78-db8b-4f72-a51f-d64d579c22b4", "service_type": "twitter", "username": "testuser" }
],
"performance_samples": [],
"genres": [

View File

@ -3,8 +3,7 @@
const showSidePanelContent = () => {
cy.get('[data-testid=profileSidePanel] h4').should('have.text', 'Test User1');
cy.get('[data-testid=profileSidePanel] .modal-body p').within(() => {
cy.contains('Location: Denver, US')
.and('contain', 'Location: Denver, US')
cy.contains('Location: Denver, CO, US')
.and('contain', 'Skill Level: Professional')
.and('contain', 'Joined JamKazam: 08-26-2021')
.and('contain', 'Last Active:')
@ -29,8 +28,13 @@ const showSidePanelContent = () => {
//cy.get('[data-testid=performance_samples]').contains('The Band')
//online presence
cy.get('[data-testid=online_presences]').contains('Soundcloud');
cy.get('[data-testid=online_presences]').contains('Reverbnation');
cy.get('[data-testid=online_presences]').contains('Soundcloud').should('have.attr', 'href').and('eq', 'https://www.soundcloud.com/testuser');
cy.get('[data-testid=online_presences]').contains('Reverbnation').should('have.attr', 'href').and('eq', 'https://www.reverbnation.com/testuser');
cy.get('[data-testid=online_presences]').contains('Bandcamp').should('have.attr', 'href').and('eq', 'https://testuser.bandcamp.com');
cy.get('[data-testid=online_presences]').contains('Fandalism').should('have.attr', 'href').and('eq', 'https://www.fandalism.com/testuser');
cy.get('[data-testid=online_presences]').contains('Youtube').should('have.attr', 'href').and('eq', 'https://www.youtube.com/testuser');
cy.get('[data-testid=online_presences]').contains('Facebook').should('have.attr', 'href').and('eq', 'https://www.facebook.com/testuser');
cy.get('[data-testid=online_presences]').contains('Twitter').should('have.attr', 'href').and('eq', 'https://www.twitter.com/testuser');
});
};
@ -80,7 +84,7 @@ describe('Friends page with data', () => {
.contains('Test User1');
});
it('click profile name', () => {
it.only('click profile name', () => {
//open side panel by clicking name
cy.get('[data-testid=peopleListTable]').within(() => {
cy.contains('Test User1').click();

View File

@ -43,6 +43,7 @@ describe("Top Navigation", () => {
});
it("shows user dropdown", () => {
showSubscribeToUpdates()
showProfileDropdown()
})

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -107,4 +107,11 @@
.swiper-person-card{
box-shadow: none !important;
border: solid 1px #eee;
}
.latency-badge{
min-width: 0%;
font-size: 8px;
position: relative;
bottom: 1px;
}

View File

@ -1,4 +1,4 @@
import React, { useContext, useEffect } from 'react';
import React, { useContext, useEffect, useRef } from 'react';
import { Switch, Route, Redirect } from 'react-router-dom';
import PrivateRoute from '../../helpers/privateRoute';
@ -6,6 +6,8 @@ import NavbarTop from '../navbar/JKNavbarTop';
import NavbarVertical from '../navbar/JKNavbarVertical';
import Footer from '../footer/JKFooter';
import { ToastContainer, toast } from 'react-toastify';
import AppContext from '../../context/Context';
import { getPageName } from '../../helpers/utils';
@ -20,7 +22,7 @@ import HomePage from '../page/JKHomePage';
import JKHelp from '../page/JKHelp';
import JKPrivacy from '../page/JKPrivacy';
import JKPeople from '../page/JKPeople';
//import JKPeople from '../page/JKPeople';
import JKPeopleFilter from '../page/JKPeopleFilter';
import JKNotifications from '../page/JKNotifications';
@ -28,12 +30,15 @@ import JKNotifications from '../page/JKNotifications';
//const DashboardRoutes = loadable(() => import('../../layouts/JKDashboardRoutes'));
//const PublicRoutes = loadable(() => import('../../layouts/JKPublicRoutes'))
function JKDashboard() {
function JKDashboardMain() {
const { isFluid, isVertical, navbarStyle } = useContext(AppContext);
const isKanban = getPageName('kanban');
const { isAuthenticated, currentUser, setCurrentUser, logout } = useAuth();
const scriptLoaded = useRef(false)
useEffect(() => {
//DashboardRoutes.preload();
//PublicRoutes.preload();
@ -42,34 +47,42 @@ function JKDashboard() {
const dispatch = useDispatch();
const initJKScripts = () => {
if(scriptLoaded.current){
return
}
const app = window.JK.JamKazam();
const jamServer = new window.JK.JamServer(app, function(event_type) {
console.log('EVENT_TYPE', event_type);
});
jamServer.initialize();
window.JK.initJamClient(app);
const clientInit = new window.JK.ClientInit();
clientInit.init();
window.JK.JamServer.connect() // singleton here defined in JamServer.js
.done(function() {
console.log('Jamserver connected');
console.log('Jamserver connected...');
//_initAfterConnect(true);
})
.fail(function() {
console.log('Jamserver connection error');
console.log('Jamserver connection error...');
//_initAfterConnect(false);
});
registerTextMessageCallback();
registerFriendRequest();
registerFriendRequestAccepted();
scriptLoaded.current = true
};
const registerTextMessageCallback = () => {
window.JK.JamServer.registerMessageCallback(window.JK.MessageType.TEXT_MESSAGE, function(header, payload) {
console.log('registerTextMessageCallback payload', payload);
console.log('registerTextMessageCallback header', header);
//console.log('registerTextMessageCallback header', header);
const msg = {
id: payload.text_message_id,
message: payload.msg,
@ -83,6 +96,16 @@ function JKDashboard() {
dispatch(addMessage(msg));
// const TextMessageToast = ({ closeToast, toastProps }) => (
// <div>
// Lorem ipsum dolor {toastProps.position}
// <button>Retry</button>
// <button onClick={closeToast}>Close</button>
// </div>
// )
// toast(<TextMessageToast />)
handleNotification(payload, header.type);
});
};
@ -148,10 +171,11 @@ function JKDashboard() {
</Switch>
{!isKanban && <Footer />}
<ToastContainer />
</div>
{/* <SidePanelModal path={location.pathname} /> */}
</div>
);
}
export default JKDashboard;
export default JKDashboardMain;

View File

@ -22,14 +22,6 @@ const JKFooter = () => {
{t('navigation.about', {ns: 'common'})}
</a>{' '}
|{' '}
<a href={`${process.env.REACT_APP_LEGACY_BASE_URL}/corp/news`} target="_blank">
{t('navigation.news', {ns: 'common'})}
</a>{' '}
|{' '}
<a href={`${process.env.REACT_APP_LEGACY_BASE_URL}/corp/media_center`} target="_blank">
{t('navigation.media', {ns: 'common'})}
</a>{' '}
|{' '}
<a href={`${process.env.REACT_APP_LEGACY_BASE_URL}/corp/contact`} target="_blank">
{t('navigation.contact', {ns: 'common'})}
</a>{' '}
@ -42,7 +34,7 @@ const JKFooter = () => {
{t('navigation.terms', {ns: 'common'})}
</a>
|{' '}
<a href={`${process.env.REACT_APP_LEGACY_BASE_URL}/corp/help`} target="_blank">
<a href={`${process.env.REACT_APP_LEGACY_BASE_URL}/help_desk`} target="_blank">
{t('navigation.help', {ns: 'common'})}
</a>
</p>

View File

@ -27,14 +27,13 @@ const TopNavRightSideNavItem = () => {
{/* <NavItem>
<SettingsAnimatedIcon />
</NavItem> */}
{!isAuthenticated && (
<>
<NavbarText className="d-none d-md-inline">{t('keep_jamkazam_improving', { ns: 'common' })}:</NavbarText>
<NavItem className="d-none d-md-inline ml-1 mr-6">
<a className="nav-link" href={`${process.env.REACT_APP_LEGACY_BASE_URL}/signup`} target="_blank">{t('subscribe', { ns: 'common' })}</a>
</NavItem>
</>
)}
<NavbarText className="d-none d-md-inline">{t('keep_jamkazam_improving', { ns: 'common' })}:</NavbarText>
<NavItem className="d-none d-md-inline ml-1 mr-6">
<a className="nav-link" href={`${process.env.REACT_APP_LEGACY_BASE_URL}/client#/account/subscription`} target="_blank">
{t('subscribe', { ns: 'common' })}
</a>
</NavItem>
<LangSwitch />
{isAuthenticated ? (

View File

@ -2,7 +2,7 @@ import React, {useEffect} from 'react'
const JKHelp = () => {
useEffect(() => {
window.location.href = `${process.env.REACT_APP_LEGACY_BASE_URL}/corp/help`
window.location.href = `${process.env.REACT_APP_LEGACY_BASE_URL}/help_desk`
return () => {
};
}, [])

View File

@ -55,7 +55,7 @@ function JKPeopleFilter() {
const lastActiveOpts = [
{ value: '', label: 'Any Range' },
{ value: '1', label: 'Within Last 1 Days' },
{ value: '1', label: 'Within Last 1 Day' },
{ value: '7', label: 'Within Last 7 Days' },
{ value: '30', label: 'Within Last 30 Days' },
{ value: '90', label: 'Within Last 90 Days' }
@ -63,7 +63,7 @@ function JKPeopleFilter() {
const joinedOpts = [
{ value: '', label: 'Any Range' },
{ value: '1', label: 'Within Last 1 Days' },
{ value: '1', label: 'Within Last 1 Day' },
{ value: '7', label: 'Within Last 7 Days' },
{ value: '30', label: 'Within Last 30 Days' },
{ value: '90', label: 'Within Last 90 Days' }

View File

@ -117,7 +117,7 @@ const JKPeopleSearch = props => {
const lastActiveOpts = [
{ value: '', label: 'Any Range' },
{ value: '1', label: 'Within Last 1 Days' },
{ value: '1', label: 'Within Last 1 Day' },
{ value: '7', label: 'Within Last 7 Days' },
{ value: '30', label: 'Within Last 30 Days' },
{ value: '90', label: 'Within Last 90 Days' }
@ -125,7 +125,7 @@ const JKPeopleSearch = props => {
const joinedOpts = [
{ value: '', label: 'Any Range' },
{ value: '1', label: 'Within Last 1 Days' },
{ value: '1', label: 'Within Last 1 Day' },
{ value: '7', label: 'Within Last 7 Days' },
{ value: '30', label: 'Within Last 30 Days' },
{ value: '90', label: 'Within Last 90 Days' }

View File

@ -5,8 +5,8 @@ const JKLatencyBadge = ({ latencyData, showAll }) => {
const LATENCY_SCORES = {
good: { label: 'GOOD', min: 0, max: 40 },
fair: { label: 'FAIR', min: 40, max: 80 },
high: { label: 'HIGH', min: 80, max: 10000000 },
fair: { label: 'FAIR', min: 40, max: 60 },
high: { label: 'HIGH', min: 60, max: 10000000 },
me: { label: 'ME', min: -1, max: -1 },
unknown: { label: 'UNKNOWN', min: -2, max: -2 }
};
@ -32,12 +32,13 @@ const JKLatencyBadge = ({ latencyData, showAll }) => {
useEffect(() => {
if (latencyData) {
setLatencyLabel(latencyData.ars_total_latency);
const tot = Math.round(latencyData.ars_internet_latency) + Math.round(latencyData.audio_latency);
setLatencyLabel(tot);
if (showAll) {
setLatencyInfo(`${Math.round(latencyData.ars_internet_latency)}ms + ${Math.round(latencyData.audio_latency)}ms`);
setLatencyInfo(`${Math.round(latencyData.ars_internet_latency)}ms (Internet) + ${Math.round(latencyData.audio_latency)}ms (audio) = ${tot}ms (total) `);
} else {
setLatencyInfo(`${Math.round(latencyData.ars_total_latency)}ms`);
setLatencyInfo(`${tot}ms`);
}
}
}, [latencyData]);

View File

@ -136,7 +136,7 @@ const JKMessageModal = props => {
return (
<>
<Modal isOpen={show} toggle={toggle} data-testid="textMessageModal">
<ModalHeader toggle={toggle}>Conversation with {user.name}</ModalHeader>
<ModalHeader toggle={toggle}>Send Message to {user.name}</ModalHeader>
<ModalBody>
<Scrollbar
ref={scrollbar}
@ -191,9 +191,9 @@ const JKMessageModal = props => {
</ModalBody>
<ModalFooter>
<Button onClick={toggle}>Close</Button>
<Button onClick={toggle}>Cancel</Button>
<Button color="primary" onClick={sendMessage} disabled={!newMessage}>
Send
Send Message
</Button>
</ModalFooter>
</Modal>

View File

@ -21,7 +21,7 @@ const JKProfileGenres = ({ genres, showAll, toggleMoreDetails }) => {
</div>
}
{
((!showAll && greaterThan.xs) || (showAll && !greaterThan.xs) && genres.length > LIMIT) && (
((!showAll && greaterThan.xs) || (showAll && !greaterThan.xs)) && genres.length > LIMIT && (
<a href="#/" onClick={e => toggleMoreDetails(e)}>
More »
</a>

View File

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { titleize } from '../../helpers/utils';
import { titleize, currencyFormat } from '../../helpers/utils';
const JKProfileInterests = ({ user }) => {
const [freeSessionGenres, setFreeSessionGenres] = useState([]);
@ -99,8 +99,8 @@ const PaidSessionInterests = ({ genres, hourlyRate, dailyRate }) => {
<div>I'm interested in playing paid gigs</div>
<ul>
<li>Genre(s): {genres.length > 0 ? genresList : 'Not specified'}</li>
<li>Horly rate: {hourlyRate ? hourlyRate : 'Not specified'}</li>
<li>Daily rate: {dailyRate ? dailyRate : 'Not specified'}</li>
<li>Hourly rate: {hourlyRate ? currencyFormat(hourlyRate/100.0) : 'Not specified'}</li>
<li>Daily rate: {dailyRate ? currencyFormat(dailyRate/100.0) : 'Not specified'}</li>
</ul>
</div>
);

View File

@ -9,31 +9,31 @@ const JKProfileOnlinePresence = ({ onlinePresences, userId }) => {
let url;
switch (item.service_type) {
case 'soundcloud':
url = 'www.soundcloud.com';
url = `https://www.soundcloud.com/${item.username}`;
break;
case 'reverbnation':
url = 'www.reverbnation.com';
url = `https://www.reverbnation.com/${item.username}`;
break;
case 'bandcamp':
url = 'www.bandcamp.com';
url = `https://${item.username}.bandcamp.com`;
break;
case 'fandalism':
url = 'www.fandalism.com';
url = `https://www.fandalism.com/${item.username}`;
break;
case 'youtube':
url = 'www.youtube.com';
url = `https://www.youtube.com/${item.username}`;
break;
case 'facebook':
url = 'www.facebook.com';
url = `https://www.facebook.com/${item.username}`;
break;
case 'twitter':
url = 'www.twitter.com';
url = `https://www.twitter.com/${item.username}`;
break;
}
return url;
@ -44,7 +44,7 @@ const JKProfileOnlinePresence = ({ onlinePresences, userId }) => {
return (
<>
{onlinePresences.map(item => (
<Link to={serviceUrl(item)} key={`${item.service_type}-${userId}`}>
<Link to={{pathname: serviceUrl(item)}} target="_blank" key={`${item.service_type}-${userId}`}>
{titleize(item.service_type)}
</Link>
)).reduce((prev, curr) => [prev, ', ', curr])

View File

@ -33,6 +33,17 @@ const JKProfileSidePanel = props => {
const joinedDate = () => {
return moment(new Date(user.created_at_timestamp * 1000)).format('MM-DD-YYYY');
};
const location = () => {
if(user.location && user.location.trim().length && user.country && user.country.trim().length){
return `${user.location}, ${user.country}`;
}else if(user.country && user.country.trim().length){
return user.country;
}else{
return "Not specified";
}
}
return (
<Modal
isOpen={show}
@ -66,7 +77,7 @@ const JKProfileSidePanel = props => {
<p>
<strong>{t('person_attributes.latency_to_me', {ns: 'people'})}:</strong> <JKLatencyBadge latencyData={latencyData} showAll={true} />
<br />
<strong>{t('person_attributes.location', {ns: 'people'})}:</strong> {`${user.city}, ${user.country}`}
<strong>{t('person_attributes.location', {ns: 'people'})}:</strong> {`${location()}`}
<br />
<strong>{t('person_attributes.skill_level', {ns: 'people'})}:</strong> <JKProfileSkillLevel skillLevel={user.skill_level} />
<br />
@ -96,21 +107,21 @@ const JKProfileSidePanel = props => {
<JKProfileGenres genres={user.genres} showAll={true} />
</div>
)}
{user.bands && user.bands.length > 0 && (
<div data-testid="bands">
<br />
<h5>{t('person_attributes.bands', {ns: 'people'})}</h5>
{user.bands.map(band => (
<p>
<a key={band.id} href="/#">
<p key={band.id} >
<a href={band.website} target='_blank'>
{band.name}
</a>
</p>
))}
</div>
)}
{user.performance_samples && user.performance_samples.length > 0 && (
<div data-testid="performance_samples">
<h5>{t('person_attributes.performance_samples', {ns: 'people'})}</h5>
@ -127,8 +138,13 @@ const JKProfileSidePanel = props => {
)}
<br />
<h5>{t('person_attributes.interests', {ns: 'people'})}</h5>
<JKProfileInterests user={user} />
{user.genres && user.genres.length > 0 && (
<>
<h5>{t('person_attributes.interests', {ns: 'people'})}</h5>
<JKProfileInterests user={user} />
</>
)}
{currentUser && (
<div className="p-3 bg-white border-top fixed-bottom">

View File

@ -230,3 +230,8 @@ export const copyToClipBoard = textFieldRef => {
document.execCommand('copy');
};
export const currencyFormat = (num) => {
return new Intl.NumberFormat('en-US',
{ style: 'currency', currency: 'USD' }
).format(num);
}

View File

@ -31,6 +31,7 @@ export const notificationsSlice = createSlice({
initialState,
reducers: {
add: (state, action) => {
console.log("notificationSlice - ADD", action.payload);
state.notifications.unshift(action.payload)
},
modify: state => {},

View File

@ -27,5 +27,9 @@ module JamRuby
@logo_url = self.band.logo_url
end
def website
@website = self.band.website
end
end
end

View File

@ -199,6 +199,9 @@
}
}
lastHeartbeatSentTime = now;
console.log("DEBUG - context.JK.JamServer", $self);
context.JK.JamServer.send(message);
lastHeartbeatFound = false;
}
@ -775,7 +778,7 @@
callbacks = server.dispatchTable[message.type];
if (message.type == context.JK.MessageType.PEER_MESSAGE) {
//logger.info("server.onMessage:" + messageType);
logger.info("server.onMessage:" + messageType);
}
else if (message.type != context.JK.MessageType.HEARTBEAT_ACK && message.type != context.JK.MessageType.PEER_MESSAGE) {
logger.info("server.onMessage:" + messageType + " payload:" + JSON.stringify(payload));
@ -940,6 +943,10 @@
registerSocketClosed();
activityCheck();
console.log("Init JK scripts....", context.JK.JamServer);
context.JK.JamServer.send("fuck u")
// $inSituBanner = $('.server-connection');
// $inSituBannerHolder = $('.no-websocket-connection');
// $messageContents = $inSituBannerHolder.find('.message-contents');

View File

@ -20,7 +20,7 @@ child :genre_players => :genres do
end
child :band_musicians => :bands do
attributes :id, :name, :admin, :photo_url, :logo_url
attributes :id, :name, :admin, :photo_url, :logo_url, :website
child :genres => :genres do
attributes :id, :description