Skip to content

Commit

Permalink
Release Version v1.17.2 (#1728)
Browse files Browse the repository at this point in the history
* Fix gurbani search issue with space. (#1707)

fixes space issue

* feat-larivaar-assist-vishraams (#1723)

adds new larivaar-assist vishraams

* changes version to v1.17.2 (#1727)

changes to version v1.17.2



Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
gurjit03 and dependabot[bot] authored Aug 9, 2024
1 parent 3b115c3 commit 81d14f2
Show file tree
Hide file tree
Showing 27 changed files with 1,514 additions and 722 deletions.
1,756 changes: 1,205 additions & 551 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sttm/web",
"version": "1.17.0",
"version": "1.17.2",
"description": "Sevadaars are currently working hard to build a newer version of SikhiToTheMax website using modern web technologies.",
"main": "index.js",
"engines": {
Expand Down Expand Up @@ -82,7 +82,7 @@
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"clean-webpack-plugin": "^3.0.0",
"css-loader": "^5.0.0",
"cypress": "^4.12.1",
"cypress": "^13.12.0",
"eslint": "^5.16.0",
"eslint-plugin-cypress": "^2.11.1",
"eslint-plugin-import": "^2.21.1",
Expand Down Expand Up @@ -132,14 +132,14 @@
"dotenv": "^9.0.2",
"esm": "^3.2.25",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"jsonwebtoken": "^9.0.0",
"lodash.throttle": "^4.1.1",
"lru": "^3.1.0",
"mariadb": "^2.5.3",
"marinate": "^0.1.5",
"passport": "^0.4.1",
"passport-google-oauth20": "^2.0.0",
"passport-saml": "^3.2.1",
"passport-saml": "^3.2.2",
"postcss-root-to-json": "0.0.0",
"react": "^16.13.1",
"react-date-picker": "^8.0.3",
Expand Down Expand Up @@ -167,4 +167,4 @@
"singleQuote": true,
"trailingComma": "es5"
}
}
}
2 changes: 1 addition & 1 deletion src/js/components/Baani/Baani.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class Baani extends React.PureComponent {
fontSize={fontSize}
lineHeight={lineHeight}
fontFamily={fontFamily}
visraams={visraams}
isVisraam={visraams}
visraam={shabad.visraam}
/>
);
Expand Down
8 changes: 4 additions & 4 deletions src/js/components/BaaniLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface Props {
fontFamily: string,
lineHeight?: number,
visraam?: Object,
visraams: boolean,
isVisraam: boolean,
isReadingMode?: boolean,
}

Expand All @@ -28,7 +28,7 @@ const BaaniLine = ({
unicode,
text,
visraam,
visraams,
isVisraam,
isReadingMode = false,
}: Props) => {

Expand All @@ -45,7 +45,7 @@ const BaaniLine = ({
enable={larivaar}
unicode={unicode}
visraam={visraam}
visraams={visraams}
isVisraam={isVisraam}
>
{unicode ? text.unicode : text.gurmukhi}
</Larivaar>
Expand All @@ -67,7 +67,7 @@ const BaaniLine = ({
enable={larivaar}
unicode={unicode}
visraam={visraam}
visraams={visraams}
isVisraam={isVisraam}
>
{unicode ? text.unicode : text.gurmukhi}
</Larivaar>
Expand Down
47 changes: 21 additions & 26 deletions src/js/components/Banner/Banner.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,46 @@
import React from 'react';
import CrossIcon from '../Icons/Times';
import { Link } from 'react-router-dom';
import { useFetchData } from '@/hooks';

const Banner = () => {
const url = "https://sttm.s3.us-west-2.amazonaws.com/urgent-message.json";

const {
isFetchingData: isFetchingBannerMessage,
data: bannerMessage,
} = useFetchData(url);

const lastSeen = sessionStorage.getItem("bannerMessage");
const updateLastSeen = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
e.currentTarget.parentElement?.remove();
sessionStorage.setItem("bannerMessage", "seen");
};

if (isFetchingBannerMessage || !bannerMessage.active || lastSeen === 'seen') {
return null
}
type Props = {
banner: {
type: string;
message: string;
label?: string;
link?: string;
classes?: {
notification?: string;
}
},
onCrossIconClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
}

const Banner = (props: Props) => {
return (
<div className="banner-container">
<div className={`notification type-${bannerMessage.data.type}`}>
<div className={`notification type-${props.banner.type} ${props.banner.classes?.notification}`}>
<div className='banner-text-container'>
<div className="banner-text">
<span className="banner-title">{bannerMessage.data.message}</span>
<span className="banner-title">{props.banner.message}</span>
</div>
{bannerMessage.data?.label &&
<button className={`banner-link-button type-${bannerMessage.data.type}`}>
{props.banner.label &&
<button className={`banner-link-button type-${props.banner.type}`}>
<Link
className="banner-link-button-text"
to={{ pathname: `https://${bannerMessage.data?.link}` }}
to={{ pathname: `https://${props.banner.link}` }}
target="_blank"
rel="noopener noreferrer"
>
{bannerMessage.data?.label}
{props.banner.label}
</Link>
</button>}
</div>
<button className="banner-cross-bg" onClick={(e) => updateLastSeen(e)}>
<button className="banner-cross-bg" onClick={(e) => props.onCrossIconClick?.(e)}>
<CrossIcon className="banner-cross" />
</button>
</div>
</div>
)
}

export default Banner;
export default Banner;
32 changes: 32 additions & 0 deletions src/js/components/Banner/MainPageBanner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import { useFetchData } from '@/hooks';
import Banner from './Banner';

const BASE_URL = "https://sttm.s3.us-west-2.amazonaws.com/urgent-message.json";

const MainPageBanner = () => {

const {
isFetchingData: isFetchingBannerMessage,
data: bannerData,
} = useFetchData(BASE_URL);

const lastSeen = sessionStorage.getItem("bannerMessage");
const updateLastSeen = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
e.currentTarget.parentElement?.remove();
sessionStorage.setItem("bannerMessage", "seen");
};

if (isFetchingBannerMessage || !bannerData.active || !bannerData.data || lastSeen === 'seen') {
return null
}

return (
<Banner
banner={bannerData.data}
onCrossIconClick={updateLastSeen}
/>
)
}

export default MainPageBanner;
6 changes: 3 additions & 3 deletions src/js/components/ControlsSettings/ControlsSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ClickableListItem from './ClickableListItem';
import Times from '../Icons/Times';
import Accordion from '../Accordion';
import { ADVANCED_SETTINGS, HEADER_SETTINGS, KEYBOARD_SHORTCUTS, QUICK_SETTINGS, RESET_SETTING } from './ControlSettings';
import { AlignLeftIcon, MinusIcon, PlusIcon, SplitViewIcon, GlobeIcon, LarivaarIcon, MicrophoneIcon, SolidArrowRight, DarkModeIcon, VishraamIcon, SteekIcon, AkhandPaathIcon, AutoPlayIcon, LarivaarAssistIcon, AlignCenterIcon, ParagraphIcon, VishraamStyleIcon, CartoonIcon, AudioPlayerIcon } from "../Icons/CustomIcons";
import { AlignLeftIcon, MinusIcon, PlusIcon, SplitViewIcon, GlobeIcon, LarivaarIcon, MicrophoneIcon, DarkModeIcon, VishraamIcon, SteekIcon, AkhandPaathIcon, AutoPlayIcon, LarivaarAssistIcon, AlignCenterIcon, ParagraphIcon, VishraamStyleIcon, CartoonIcon, AudioPlayerIcon } from "../Icons/CustomIcons";
import {
FONT_OPTIONS,
VISRAAM,
Expand Down Expand Up @@ -42,8 +42,8 @@ const ControlsSettings = (props: any) => {
clearVisraamClass();
document.body.classList[visraams ? 'add' : 'remove'](
VISRAAM.CLASS_NAME,
VISRAAM.SOURCE_CLASS(visraamSource),
VISRAAM.TYPE_CLASS(visraamStyle)
VISRAAM.getSourceClass(visraamSource),
VISRAAM.getTypeClass(visraamStyle)
);
wrapperRef.current.focus();
}, [visraams, visraamSource, visraamStyle])
Expand Down
6 changes: 6 additions & 0 deletions src/js/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ class Header extends React.PureComponent {
e.preventDefault();
e.stopPropagation();
handleSubmit();
// Remove the last space in from the searched query.
const isNotAngSearch = SEARCH_TYPES[data.type] !== SEARCH_TYPES.ANG;
if(isNotAngSearch) {
data.query = data.query.trim();
}

this.handleFormSubmit(data);
};

Expand Down
13 changes: 8 additions & 5 deletions src/js/components/Larivaar/ImprovedLarivaar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface Props {
children: string;
query: string;
visraam: Object;
visraams: boolean;
isVisraam: boolean;
isShowMahankoshTooltip?: boolean;
}

Expand All @@ -30,7 +30,7 @@ export const Larivaar = ({
unicode,
query,
visraam,
visraams,
isVisraam,
isShowMahankoshTooltip = false,
}: Props) => {
const dispatch = useDispatch();
Expand Down Expand Up @@ -93,15 +93,18 @@ export const Larivaar = ({
if (['॥', ']'].some(v => word.includes(v))) {
return `${word} `;
}
const visraamClass = getVisraamClass(children, index, visraam);

const isBothLarivaarAssistAndVisraam = isVisraam && larivaarAssist;

const visraamClass = getVisraamClass({akharIndex: index, visraams: visraam, isBothLarivaarAssistAndVisraam});
let akharClass = '';

if (isShowMahankoshTooltip) {
akharClass += ' mahankoshSelectedGurbaniWord';
}

const mahankoshTooltipAttributes = isShowMahankoshTooltip ? getMahankoshTooltipAttributes({isDarkMode, content: word}) : {};

return (
<span
key={index}
Expand All @@ -123,7 +126,7 @@ export const Larivaar = ({
index={index}
visraamClass={visraamClass}
visraam={visraam}
visraams={visraams}
isVisraam={isVisraam}
/>
</span>
);
Expand Down
9 changes: 5 additions & 4 deletions src/js/components/Larivaar/Word.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export interface Props {
larivaarAssist?: boolean;
larivaarAssistColor: string;
index: number;
highlightIndex?: Array<number>;
highlightIndex?: number[];
visraam: Object;
visraams: boolean;
isVisraam: boolean;
visraamClass: string;
highlight?: boolean;
}
Expand All @@ -25,12 +25,13 @@ const LarivaarWord = ({
larivaarAssistColor,
index,
highlight,
visraams,
isVisraam,
visraamClass,
}: Props) => {

const isOddIdx = index % 2 === 1;
const isColoredLarivaarAssist = larivaarAssist && isOddIdx;

const segments = unicode
? fixLarivaarUnicode(word)
: fixLarivaarGurmukhiFont(word);
Expand All @@ -47,7 +48,7 @@ const LarivaarWord = ({

return (
<span
className={visraams ? visraamClass : '' + ' gurbani-word'}
className={isVisraam ? visraamClass : '' + ' gurbani-word'}
>
{segments.map((item, i) => {
const key = `${index}.${i}`;
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/Layout.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import Header from './Header';
import Footer from './Footer';
import Banner from './Banner/Banner';
import MainPageBanner from './Banner/MainPageBanner';
import GenericError, { SachKaur, BalpreetSingh } from './GenericError';
import PropTypes from 'prop-types';
import { DEFAULT_PAGE_TITLE, LOCAL_STORAGE_KEY_FOR_SESSION_TOKEN, TEXTS } from '../constants';
Expand Down Expand Up @@ -113,7 +113,7 @@ class Layout extends React.PureComponent {

return online || pathname !== '/' ? (
<React.Fragment>
<Banner />
<MainPageBanner />
{isAddFavoriteShabadModalOpen && <AddFavouriteShabadModal open={isAddFavoriteShabadModalOpen} />}
<div className={`pusher ${showMultiViewPanel ? 'enable' : ''} pin-settings ${showPinSettings ? 'active' : ''}`}>
<Header
Expand Down
11 changes: 4 additions & 7 deletions src/js/components/Notifier/Notification.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import React from 'react';

interface INotificationProps {
interface Props {
title: string,
message: string
}

export const Notification: React.FC<INotificationProps> = ({
title,
message
}) => {
export const Notification = (props: Props) => {
return (
<div className="toastNotification">
<h3 className="toastNotificationTitle">{title}</h3>
<span className="toastNotificationContent">{message}</span>
<h3 className="toastNotificationTitle">{props.title}</h3>
<span className="toastNotificationContent">{props.message}</span>
</div>
)
}
6 changes: 3 additions & 3 deletions src/js/components/SearchResults/HighlightedResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ const HighlightedSearchResult = (props: Props) => {
const isDarkMode = useSelector(state => state.darkMode);

return props.children?.split(' ').map((word: string, i: number) => {
let akharClass = getVisraamClass(props.children, i, props.visraams) || ' ';
let akharClass = getVisraamClass({akharIndex: i, visraams: props.visraams}) || ' ';

if (props.highlightIndex && props.highlightIndex.length > 0) {
if (props.highlightIndex.includes(i)) {
if (props.highlightIndex.includes(`${i}`)) {
akharClass += 'search-highlight-word'
}
}
Expand All @@ -40,7 +41,6 @@ const HighlightedSearchResult = (props: Props) => {

const mahankoshTooltipAttributes = props.isShowMahankoshTooltip ? getMahankoshTooltipAttributes({isDarkMode, content: word}) : {};


return (
<span
key={i}
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/ShabadControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ class ShabadControls extends React.PureComponent {
clearVisraamClass();
document.body.classList[this.props.visraams ? 'add' : 'remove'](
VISRAAM.CLASS_NAME,
VISRAAM.SOURCE_CLASS(this.props.visraamSource),
VISRAAM.TYPE_CLASS(this.props.visraamStyle)
VISRAAM.getSourceClass(this.props.visraamSource),
VISRAAM.getTypeClass(this.props.visraamStyle)
);
}

Expand Down
3 changes: 2 additions & 1 deletion src/js/constants/default-option-values.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { MAX_LARIVAAR_ASSIST_STRENGTH } from './maximum';
import { SEARCH_TYPES } from "./search-types";
import { VISRAAM } from './visraam';

export const DEFAULT_SEARCH_TYPE = SEARCH_TYPES.FIRST_LETTERS;
export const DEFAULT_SEARCH_SOURCE = 'all';
Expand Down Expand Up @@ -29,7 +30,7 @@ export const DEFAULT_PARAGRAPH_MODE = false;
export const DEFAULT_CENTER_ALIGN_GURBANI = false;
export const DEFAULT_VISRAAMS = false;
export const DEFAULT_VISRAAM_SOURCE = 'sttm';
export const DEFAULT_VISRAAM_STYLE = 'colored-words';
export const DEFAULT_VISRAAM_STYLE = VISRAAM.TYPES['colored-words'];
export const DEFAULT_SEHAJ_PAATH_MODE = false;
export const DEFAULT_CARTOONIFIED_PAGES = false;
export const DEFAULT_SHABAD_AUDIO_PLAYER = true;
Expand Down
Loading

0 comments on commit 81d14f2

Please sign in to comment.