change browse session no records alert

This commit is contained in:
Nuwan 2024-10-05 02:58:48 +05:30
parent 0377f73b9f
commit 2afd8500bd
5 changed files with 33 additions and 7 deletions

View File

@ -19,7 +19,9 @@ describe('Browse sessions', () => {
});
it('alerts when there is no records', () => {
cy.contains('No Records!');
cy.contains('There are no public, open sessions currently available for you to join');
cy.contains('create a session').click();
cy.url().should('include', '/sessions/new');
});
});

View File

@ -27,6 +27,26 @@ beforeEach(() => {
statusCode: 200,
body: [],
}).as('getAppFeatures');
cy.intercept('GET', /\S+\/users\/\S+\/profile/, {
statusCode: 200,
body: {
id: 1,
name: 'Jane Doe',
email: 'jane@example.com',
},
}).as('getUserProfile');
cy.intercept('GET', /\S+\/users\/\S+\/my_notifications/, {
statusCode: 200,
body: [],
}).as('getMyNotifications');
cy.intercept('GET', /\S+\/users\/\S+\/friends/, {
statusCode: 200,
body: [],
}).as('getMyFriends');
});

View File

@ -1,5 +1,6 @@
import React, { useEffect } from 'react';
import { Alert, Col, Row, Card, CardBody } from 'reactstrap';
import { Col, Row, Card, CardBody } from 'reactstrap';
import { Link } from 'react-router-dom';
import FalconCardHeader from '../common/FalconCardHeader';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
@ -53,9 +54,9 @@ function JKMusicSessions() {
) : (
<Row className="p-card">
<Col>
<Alert color="info" className="mb-0">
{t('no_records', { ns: 'common' })}
</Alert>
{t('list.no_records_1', { ns: 'sessions' })}
<Link to="/sessions/new">{t('list.create_session', { ns: 'sessions' })}</Link>
{t('list.no_records_2', { ns: 'sessions' })}
</Col>
</Row>
)}

View File

@ -37,7 +37,10 @@
"notes": {
"invited": "YOU WERE INVITED TO THIS SESSION",
"has_friend": "YOU HAVE A FRIEND IN THIS SESSION"
}
},
"no_records_1": "There are no public, open sessions currently available for you to join. We suggest you ",
"create_session": "create a session",
"no_records_2": " that others can join now, or wait a bit and then refresh this page in your browser to see if new public sessions have been started."
},
"lobby": {
"page_title": "Lobby",

View File

@ -545,7 +545,7 @@ class ApiUsersController < ApiController
limit = 20 if limit <= 0
offset = params[:offset].to_i
offset = 0 if offset < 0
query = @notifications = @user.notifications.joins(:source_user)
query = @user.notifications.joins(:source_user)
@unread_total = query.unread.size
@notifications = query.offset(offset).limit(limit)
@next = @notifications.size > 0 ? offset + limit : nil