@financial-times/qanda-ui 0.0.1-beta.20 → 0.0.1-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/components/Calendar/Apps.js +2 -1
- package/dist/cjs/components/EmbedFormField/index.js +2 -1
- package/dist/cjs/components/ExpertDrawer/index.js +2 -1
- package/dist/cjs/components/QandaBlock/index.js +2 -1
- package/dist/cjs/components/QandaContainer.js +5 -4
- package/dist/cjs/components/QuestionForm/messagesByUserType.js +2 -1
- package/dist/cjs/components/Stream/index.js +2 -2
- package/dist/cjs/config/qanda.js +6 -0
- package/dist/esm/components/Calendar/Apps.js +2 -1
- package/dist/esm/components/EmbedFormField/index.js +2 -1
- package/dist/esm/components/ExpertDrawer/index.js +2 -1
- package/dist/esm/components/QandaBlock/index.js +2 -1
- package/dist/esm/components/QandaContainer.js +5 -4
- package/dist/esm/components/QuestionForm/messagesByUserType.js +2 -1
- package/dist/esm/components/Stream/index.js +2 -2
- package/dist/esm/config/qanda.js +3 -0
- package/dist/qanda.scss +4 -4
- package/dist/types/components/QuestionForm/messagesByUserType.d.ts +1 -1
- package/dist/types/config/qanda.d.ts +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("preact/jsx-runtime");
|
|
4
|
+
const qanda_1 = require("../../config/qanda");
|
|
4
5
|
function formatDateForIcs(date) {
|
|
5
6
|
return date.replace(/-|:|\.\d+/g, '');
|
|
6
7
|
}
|
|
@@ -14,7 +15,7 @@ const CalendarLink = ({ href, children, }) => ((0, jsx_runtime_1.jsx)("a", { hre
|
|
|
14
15
|
function itemChildren(name, icon) {
|
|
15
16
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "live-qa-calendar-list__item__icon", children: icon }), (0, jsx_runtime_1.jsx)("span", { className: "live-qa-calendar-list__item__text", children: name })] }));
|
|
16
17
|
}
|
|
17
|
-
const description = (url) => `To join the
|
|
18
|
+
const description = (url) => `To join the ${qanda_1.PRODUCT_NAME} session, visit: ${url}`;
|
|
18
19
|
const apps = [
|
|
19
20
|
{
|
|
20
21
|
name: 'Gmail',
|
|
@@ -5,6 +5,7 @@ const react_redux_1 = require("react-redux");
|
|
|
5
5
|
const questionSlice_1 = require("../../store/questionSlice");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const react_dom_1 = require("react-dom");
|
|
8
|
+
const qanda_1 = require("../../config/qanda");
|
|
8
9
|
function EmbedFormField({ container }) {
|
|
9
10
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
10
11
|
const [portalTarget, setPortalTarget] = (0, react_1.useState)();
|
|
@@ -18,7 +19,7 @@ function EmbedFormField({ container }) {
|
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
}, []);
|
|
21
|
-
const portalElement = ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-portal embed-form-field__container o3-type-body-highlight", children: ["Submit your question
|
|
22
|
+
const portalElement = ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-portal embed-form-field__container o3-type-body-highlight", children: ["Submit your question for ", qanda_1.PRODUCT_NAME, (0, jsx_runtime_1.jsxs)("div", { onClick: () => dispatch((0, questionSlice_1.openForm)()), className: "embed-form-field__text-input o3-type-body-lg", "data-testid": "embed-form-field", children: [(0, jsx_runtime_1.jsx)("span", { className: "embed-form-field__icon", children: (0, jsx_runtime_1.jsx)("i", { style: { maskImage: 'var(--o3-icon-user)' } }) }), "Enter your question"] })] }));
|
|
22
23
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, react_dom_1.createPortal)(portalElement, portalTarget || document.body) });
|
|
23
24
|
}
|
|
24
25
|
exports.default = EmbedFormField;
|
|
@@ -11,6 +11,7 @@ const expertSlice_1 = require("../../store/expertSlice");
|
|
|
11
11
|
const QandaProvider_1 = require("../QandaProvider");
|
|
12
12
|
const reliability_1 = require("../../services/reliability");
|
|
13
13
|
const Overlay_1 = __importDefault(require("../Overlay"));
|
|
14
|
+
const qanda_1 = require("../../config/qanda");
|
|
14
15
|
function ExpertDrawer() {
|
|
15
16
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
16
17
|
const { storyId, useStaging, title } = (0, react_1.useContext)(QandaProvider_1.QandaContext);
|
|
@@ -28,7 +29,7 @@ function ExpertDrawer() {
|
|
|
28
29
|
if (!isExpertFormOpen) {
|
|
29
30
|
return null;
|
|
30
31
|
}
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)(Overlay_1.default, { title:
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(Overlay_1.default, { title: qanda_1.PRODUCT_NAME, closeCallback: () => dispatch((0, expertSlice_1.closeExpertForm)()), options: {
|
|
32
33
|
shadow: true,
|
|
33
34
|
noBackground: true,
|
|
34
35
|
}, children: (0, jsx_runtime_1.jsx)("div", { className: "o-comments", id: "o-comments-stream", "data-o-component": "o-comments", "data-o-comments-article-id": storyId, "data-o-comments-article-url": `https://www.ft.com/content/${storyId}`, "data-o-comments-use-staging-environment": useStaging, "data-o-comments-title": title }) }));
|
|
@@ -55,7 +55,8 @@ function QandaBlock({ id, body, children, byline, subtitle, showAnswerTime = fal
|
|
|
55
55
|
const scale = 1 + 0.04 * factorRef.current;
|
|
56
56
|
const shadow = interpolateColor(factorRef.current);
|
|
57
57
|
currentBubble.style.transform = `scale(${scale})`;
|
|
58
|
-
|
|
58
|
+
// NB: drop-shadow blur radius is not calculated the same way as box-shadow blur radius, halving it matches
|
|
59
|
+
currentBubble.style.filter = `drop-shadow(0px 2px 4px ${shadow})`;
|
|
59
60
|
if (factorRef.current < 0.001 && distanceRatio > 0.95) {
|
|
60
61
|
currentBubble.removeAttribute('style');
|
|
61
62
|
currentBubble = null;
|
|
@@ -19,6 +19,7 @@ const EmbedFormField_1 = __importDefault(require("./EmbedFormField"));
|
|
|
19
19
|
const QandaProvider_1 = require("./QandaProvider");
|
|
20
20
|
const o_tracking_1 = __importDefault(require("@financial-times/o-tracking"));
|
|
21
21
|
const comments_api_1 = require("../services/comments-api");
|
|
22
|
+
const qanda_1 = require("../config/qanda");
|
|
22
23
|
function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
|
|
23
24
|
const { storyId, useStaging, commentsAPIUrl } = (0, react_1.useContext)(QandaProvider_1.QandaContext);
|
|
24
25
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
@@ -32,13 +33,13 @@ function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
|
|
|
32
33
|
const [ariaMessage, setAriaMessage] = (0, react_1.useState)('');
|
|
33
34
|
(0, react_1.useEffect)(() => {
|
|
34
35
|
if (isLoading) {
|
|
35
|
-
setAriaMessage(
|
|
36
|
+
setAriaMessage(`Loading ${qanda_1.PRODUCT_NAME}`);
|
|
36
37
|
}
|
|
37
38
|
else if (error) {
|
|
38
|
-
setAriaMessage(
|
|
39
|
+
setAriaMessage(`Error loading ${qanda_1.PRODUCT_NAME}`);
|
|
39
40
|
}
|
|
40
41
|
else if (data) {
|
|
41
|
-
setAriaMessage(
|
|
42
|
+
setAriaMessage(`${qanda_1.PRODUCT_NAME} stream has been updated`);
|
|
42
43
|
}
|
|
43
44
|
}, [isLoading, error, data]);
|
|
44
45
|
const updatedQA = (0, comments_api_1.useUpdatedQA)({
|
|
@@ -94,6 +95,6 @@ function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
|
|
|
94
95
|
},
|
|
95
96
|
});
|
|
96
97
|
}, [data, status]);
|
|
97
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-container", "data-trackable": "liveqa", children: [error && ((0, jsx_runtime_1.jsxs)("p", { children: ["We are not able to load
|
|
98
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-container", "data-trackable": "liveqa", children: [error && ((0, jsx_runtime_1.jsxs)("p", { children: ["We are not able to load ", qanda_1.PRODUCT_NAME, " at the moment. Please try again later. Error:", error] })), !isLoading && !error && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [status !== 'close' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showExpertView ? (0, jsx_runtime_1.jsx)(ExpertDrawer_1.default, {}) : (0, jsx_runtime_1.jsx)(QuestionForm_1.default, {}), (0, jsx_runtime_1.jsx)(CountdownTimer_1.default, { container: countdownTimerContainer })] })), status === 'pre-live' && (0, jsx_runtime_1.jsx)(Calendar_1.default, {}), (0, jsx_runtime_1.jsx)(Stream_1.default, { status: status }), (0, jsx_runtime_1.jsx)(Survey_1.default, { storyId: storyId, status: status }), (status === 'live' || (status === 'pre-live' && showExpertView)) && ((0, jsx_runtime_1.jsx)(FloatingActionBar_1.default, { showLiveIndicator: status === 'live' })), status !== 'close' && !showExpertView && ((0, jsx_runtime_1.jsx)(EmbedFormField_1.default, { container: embedFormFieldContainer }))] })), (0, jsx_runtime_1.jsx)("div", { "aria-live": "polite", "aria-atomic": "true", className: "o3-visually-hidden", children: ariaMessage })] }));
|
|
98
99
|
}
|
|
99
100
|
exports.default = QandaContainer;
|
|
@@ -4,13 +4,14 @@ exports.TERMS_AND_CONDITIONS_URL = exports.COMMUNITY_GUIDELINES_URL = exports.SU
|
|
|
4
4
|
exports.getTitleByUser = getTitleByUser;
|
|
5
5
|
exports.getTextByUser = getTextByUser;
|
|
6
6
|
const jsx_runtime_1 = require("preact/jsx-runtime");
|
|
7
|
+
const qanda_1 = require("../../config/qanda");
|
|
7
8
|
exports.SIGN_IN_URL = 'https://www.ft.com/login';
|
|
8
9
|
exports.SUBSCRIBE_URL = 'https://subs.ft.com/products';
|
|
9
10
|
exports.COMMUNITY_GUIDELINES_URL = 'https://help.ft.com/help/article-queries/commenting-on-an-article/commenting-guidelines';
|
|
10
11
|
exports.TERMS_AND_CONDITIONS_URL = 'https://help.ft.com/help/legal-privacy/terms-conditions';
|
|
11
12
|
function getTitleByUser(profile) {
|
|
12
13
|
if (profile.isSubscribed) {
|
|
13
|
-
return
|
|
14
|
+
return `${qanda_1.PRODUCT_NAME} guidelines`;
|
|
14
15
|
}
|
|
15
16
|
if (profile.isTrialist) {
|
|
16
17
|
return 'You are still on a trial period';
|
|
@@ -28,9 +28,9 @@ function Stream({ status = 'pre-live' }) {
|
|
|
28
28
|
const element = document.getElementById(latestAnsweredQuestionId);
|
|
29
29
|
element?.scrollIntoView({ behavior: 'smooth' });
|
|
30
30
|
}, [latestAnsweredQuestionId]);
|
|
31
|
-
return ((0, jsx_runtime_1.jsxs)("section", { className: "qanda__stream", children: [(0, jsx_runtime_1.jsx)("h2", { className: "o3-type-title-md qanda__stream-title", children: data
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)("section", { className: "qanda__stream", children: [data && data.qandas.length > 0 && ((0, jsx_runtime_1.jsx)("h2", { className: "o3-type-title-md qanda__stream-title", children: data.status && data.status === 'pre-live'
|
|
32
32
|
? 'Top questions so far'
|
|
33
|
-
: 'What our readers are asking' }), (0, jsx_runtime_1.jsxs)("div", { className: "qanda__blocks-container", "data-testid": "qanda__blocks-container", id: "qanda__blocks-container", "aria-busy": isLoading, children: [isLoading && ((0, jsx_runtime_1.jsx)(Loader_1.default, { theme: "dark", extraClassNames: "qanda__stream-loader" })), error && ((0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { error: error, storyId: storyId, operation: "loading-stream" })), data &&
|
|
33
|
+
: 'What our readers are asking' })), (0, jsx_runtime_1.jsxs)("div", { className: "qanda__blocks-container", "data-testid": "qanda__blocks-container", id: "qanda__blocks-container", "aria-busy": isLoading, children: [isLoading && ((0, jsx_runtime_1.jsx)(Loader_1.default, { theme: "dark", extraClassNames: "qanda__stream-loader" })), error && ((0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { error: error, storyId: storyId, operation: "loading-stream" })), data &&
|
|
34
34
|
data.qandas &&
|
|
35
35
|
data.qandas.map((qandaBlock) => ((0, jsx_runtime_1.jsx)(index_1.default, { id: qandaBlock.id, body: qandaBlock.body, type: "comment", publishedDate: qandaBlock.publishedDate, author: qandaBlock.author, byline: qandaBlock.byline, showAnswerTime: data.status === 'live', children: qandaBlock.children }, qandaBlock.id)))] })] }));
|
|
36
36
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PRODUCT_NAME = void 0;
|
|
4
|
+
// This file contains configuration settings for the Q&A (AKA Ask an Expert) features of the application.
|
|
5
|
+
// User facing product name
|
|
6
|
+
exports.PRODUCT_NAME = 'Ask an Expert';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { PRODUCT_NAME } from '../../config/qanda';
|
|
2
3
|
function formatDateForIcs(date) {
|
|
3
4
|
return date.replace(/-|:|\.\d+/g, '');
|
|
4
5
|
}
|
|
@@ -12,7 +13,7 @@ const CalendarLink = ({ href, children, }) => (_jsx("a", { href: href, target: "
|
|
|
12
13
|
function itemChildren(name, icon) {
|
|
13
14
|
return (_jsxs(_Fragment, { children: [_jsx("span", { className: "live-qa-calendar-list__item__icon", children: icon }), _jsx("span", { className: "live-qa-calendar-list__item__text", children: name })] }));
|
|
14
15
|
}
|
|
15
|
-
const description = (url) => `To join the
|
|
16
|
+
const description = (url) => `To join the ${PRODUCT_NAME} session, visit: ${url}`;
|
|
16
17
|
const apps = [
|
|
17
18
|
{
|
|
18
19
|
name: 'Gmail',
|
|
@@ -3,6 +3,7 @@ import { useDispatch } from 'react-redux';
|
|
|
3
3
|
import { openForm } from '../../store/questionSlice';
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
6
|
+
import { PRODUCT_NAME } from '../../config/qanda';
|
|
6
7
|
function EmbedFormField({ container }) {
|
|
7
8
|
const dispatch = useDispatch();
|
|
8
9
|
const [portalTarget, setPortalTarget] = useState();
|
|
@@ -16,7 +17,7 @@ function EmbedFormField({ container }) {
|
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
19
|
}, []);
|
|
19
|
-
const portalElement = (_jsxs("div", { className: "qanda-portal embed-form-field__container o3-type-body-highlight", children: ["Submit your question
|
|
20
|
+
const portalElement = (_jsxs("div", { className: "qanda-portal embed-form-field__container o3-type-body-highlight", children: ["Submit your question for ", PRODUCT_NAME, _jsxs("div", { onClick: () => dispatch(openForm()), className: "embed-form-field__text-input o3-type-body-lg", "data-testid": "embed-form-field", children: [_jsx("span", { className: "embed-form-field__icon", children: _jsx("i", { style: { maskImage: 'var(--o3-icon-user)' } }) }), "Enter your question"] })] }));
|
|
20
21
|
return _jsx(_Fragment, { children: createPortal(portalElement, portalTarget || document.body) });
|
|
21
22
|
}
|
|
22
23
|
export default EmbedFormField;
|
|
@@ -6,6 +6,7 @@ import { closeExpertForm } from '../../store/expertSlice';
|
|
|
6
6
|
import { QandaContext } from '../QandaProvider';
|
|
7
7
|
import { qandaReliability } from '../../services/reliability';
|
|
8
8
|
import Overlay from '../Overlay';
|
|
9
|
+
import { PRODUCT_NAME } from '../../config/qanda';
|
|
9
10
|
function ExpertDrawer() {
|
|
10
11
|
const dispatch = useDispatch();
|
|
11
12
|
const { storyId, useStaging, title } = useContext(QandaContext);
|
|
@@ -23,7 +24,7 @@ function ExpertDrawer() {
|
|
|
23
24
|
if (!isExpertFormOpen) {
|
|
24
25
|
return null;
|
|
25
26
|
}
|
|
26
|
-
return (_jsx(Overlay, { title:
|
|
27
|
+
return (_jsx(Overlay, { title: PRODUCT_NAME, closeCallback: () => dispatch(closeExpertForm()), options: {
|
|
27
28
|
shadow: true,
|
|
28
29
|
noBackground: true,
|
|
29
30
|
}, children: _jsx("div", { className: "o-comments", id: "o-comments-stream", "data-o-component": "o-comments", "data-o-comments-article-id": storyId, "data-o-comments-article-url": `https://www.ft.com/content/${storyId}`, "data-o-comments-use-staging-environment": useStaging, "data-o-comments-title": title }) }));
|
|
@@ -50,7 +50,8 @@ function QandaBlock({ id, body, children, byline, subtitle, showAnswerTime = fal
|
|
|
50
50
|
const scale = 1 + 0.04 * factorRef.current;
|
|
51
51
|
const shadow = interpolateColor(factorRef.current);
|
|
52
52
|
currentBubble.style.transform = `scale(${scale})`;
|
|
53
|
-
|
|
53
|
+
// NB: drop-shadow blur radius is not calculated the same way as box-shadow blur radius, halving it matches
|
|
54
|
+
currentBubble.style.filter = `drop-shadow(0px 2px 4px ${shadow})`;
|
|
54
55
|
if (factorRef.current < 0.001 && distanceRatio > 0.95) {
|
|
55
56
|
currentBubble.removeAttribute('style');
|
|
56
57
|
currentBubble = null;
|
|
@@ -14,6 +14,7 @@ import EmbedFormField from './EmbedFormField';
|
|
|
14
14
|
import { QandaContext } from './QandaProvider';
|
|
15
15
|
import oTracking from '@financial-times/o-tracking';
|
|
16
16
|
import { useGetQandAStreamQuery, useUpdatedQA, useGetUserRolesQuery, nextCommentsApi, } from '../services/comments-api';
|
|
17
|
+
import { PRODUCT_NAME } from '../config/qanda';
|
|
17
18
|
function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
|
|
18
19
|
const { storyId, useStaging, commentsAPIUrl } = useContext(QandaContext);
|
|
19
20
|
const dispatch = useDispatch();
|
|
@@ -27,13 +28,13 @@ function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
|
|
|
27
28
|
const [ariaMessage, setAriaMessage] = useState('');
|
|
28
29
|
useEffect(() => {
|
|
29
30
|
if (isLoading) {
|
|
30
|
-
setAriaMessage(
|
|
31
|
+
setAriaMessage(`Loading ${PRODUCT_NAME}`);
|
|
31
32
|
}
|
|
32
33
|
else if (error) {
|
|
33
|
-
setAriaMessage(
|
|
34
|
+
setAriaMessage(`Error loading ${PRODUCT_NAME}`);
|
|
34
35
|
}
|
|
35
36
|
else if (data) {
|
|
36
|
-
setAriaMessage(
|
|
37
|
+
setAriaMessage(`${PRODUCT_NAME} stream has been updated`);
|
|
37
38
|
}
|
|
38
39
|
}, [isLoading, error, data]);
|
|
39
40
|
const updatedQA = useUpdatedQA({
|
|
@@ -89,6 +90,6 @@ function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
|
|
|
89
90
|
},
|
|
90
91
|
});
|
|
91
92
|
}, [data, status]);
|
|
92
|
-
return (_jsxs("div", { className: "qanda-container", "data-trackable": "liveqa", children: [error && (_jsxs("p", { children: ["We are not able to load
|
|
93
|
+
return (_jsxs("div", { className: "qanda-container", "data-trackable": "liveqa", children: [error && (_jsxs("p", { children: ["We are not able to load ", PRODUCT_NAME, " at the moment. Please try again later. Error:", error] })), !isLoading && !error && (_jsxs(_Fragment, { children: [status !== 'close' && (_jsxs(_Fragment, { children: [showExpertView ? _jsx(ExpertDrawer, {}) : _jsx(QuestionForm, {}), _jsx(CountdownTimer, { container: countdownTimerContainer })] })), status === 'pre-live' && _jsx(Calendar, {}), _jsx(Stream, { status: status }), _jsx(Survey, { storyId: storyId, status: status }), (status === 'live' || (status === 'pre-live' && showExpertView)) && (_jsx(FloatingActionBar, { showLiveIndicator: status === 'live' })), status !== 'close' && !showExpertView && (_jsx(EmbedFormField, { container: embedFormFieldContainer }))] })), _jsx("div", { "aria-live": "polite", "aria-atomic": "true", className: "o3-visually-hidden", children: ariaMessage })] }));
|
|
93
94
|
}
|
|
94
95
|
export default QandaContainer;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { PRODUCT_NAME } from '../../config/qanda';
|
|
2
3
|
export const SIGN_IN_URL = 'https://www.ft.com/login';
|
|
3
4
|
export const SUBSCRIBE_URL = 'https://subs.ft.com/products';
|
|
4
5
|
export const COMMUNITY_GUIDELINES_URL = 'https://help.ft.com/help/article-queries/commenting-on-an-article/commenting-guidelines';
|
|
5
6
|
export const TERMS_AND_CONDITIONS_URL = 'https://help.ft.com/help/legal-privacy/terms-conditions';
|
|
6
7
|
export function getTitleByUser(profile) {
|
|
7
8
|
if (profile.isSubscribed) {
|
|
8
|
-
return
|
|
9
|
+
return `${PRODUCT_NAME} guidelines`;
|
|
9
10
|
}
|
|
10
11
|
if (profile.isTrialist) {
|
|
11
12
|
return 'You are still on a trial period';
|
|
@@ -23,9 +23,9 @@ function Stream({ status = 'pre-live' }) {
|
|
|
23
23
|
const element = document.getElementById(latestAnsweredQuestionId);
|
|
24
24
|
element?.scrollIntoView({ behavior: 'smooth' });
|
|
25
25
|
}, [latestAnsweredQuestionId]);
|
|
26
|
-
return (_jsxs("section", { className: "qanda__stream", children: [_jsx("h2", { className: "o3-type-title-md qanda__stream-title", children: data
|
|
26
|
+
return (_jsxs("section", { className: "qanda__stream", children: [data && data.qandas.length > 0 && (_jsx("h2", { className: "o3-type-title-md qanda__stream-title", children: data.status && data.status === 'pre-live'
|
|
27
27
|
? 'Top questions so far'
|
|
28
|
-
: 'What our readers are asking' }), _jsxs("div", { className: "qanda__blocks-container", "data-testid": "qanda__blocks-container", id: "qanda__blocks-container", "aria-busy": isLoading, children: [isLoading && (_jsx(Loader, { theme: "dark", extraClassNames: "qanda__stream-loader" })), error && (_jsx(ErrorMessage, { error: error, storyId: storyId, operation: "loading-stream" })), data &&
|
|
28
|
+
: 'What our readers are asking' })), _jsxs("div", { className: "qanda__blocks-container", "data-testid": "qanda__blocks-container", id: "qanda__blocks-container", "aria-busy": isLoading, children: [isLoading && (_jsx(Loader, { theme: "dark", extraClassNames: "qanda__stream-loader" })), error && (_jsx(ErrorMessage, { error: error, storyId: storyId, operation: "loading-stream" })), data &&
|
|
29
29
|
data.qandas &&
|
|
30
30
|
data.qandas.map((qandaBlock) => (_jsx(QandaBlock, { id: qandaBlock.id, body: qandaBlock.body, type: "comment", publishedDate: qandaBlock.publishedDate, author: qandaBlock.author, byline: qandaBlock.byline, showAnswerTime: data.status === 'live', children: qandaBlock.children }, qandaBlock.id)))] })] }));
|
|
31
31
|
}
|
package/dist/qanda.scss
CHANGED
|
@@ -507,7 +507,7 @@ $app-header-color: #007acc;
|
|
|
507
507
|
|
|
508
508
|
:root {
|
|
509
509
|
--speech-triangle-width: 24px;
|
|
510
|
-
--speech-triangle-height:
|
|
510
|
+
--speech-triangle-height: 17px;
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
.qanda-container {
|
|
@@ -520,7 +520,7 @@ $app-header-color: #007acc;
|
|
|
520
520
|
.qanda-block__comment {
|
|
521
521
|
padding: var(--o3-spacing-s) var(--o3-spacing-2xs);
|
|
522
522
|
position: relative;
|
|
523
|
-
filter: drop-shadow(
|
|
523
|
+
filter: drop-shadow(0 1px 2px var(--o3-color-palette-black-20, #ccc1b7));
|
|
524
524
|
will-change: filter;
|
|
525
525
|
}
|
|
526
526
|
|
|
@@ -537,7 +537,7 @@ $app-header-color: #007acc;
|
|
|
537
537
|
.qanda-block__question::after {
|
|
538
538
|
content: '';
|
|
539
539
|
position: absolute;
|
|
540
|
-
bottom: calc(var(--speech-triangle-height) * -1);
|
|
540
|
+
bottom: calc(var(--speech-triangle-height) * -1 + 1px);
|
|
541
541
|
right: 0;
|
|
542
542
|
border-left: var(--speech-triangle-width) solid transparent;
|
|
543
543
|
border-top: var(--speech-triangle-height) solid
|
|
@@ -547,7 +547,7 @@ $app-header-color: #007acc;
|
|
|
547
547
|
.qanda-block__answer::before {
|
|
548
548
|
content: '';
|
|
549
549
|
position: absolute;
|
|
550
|
-
top: calc(var(--speech-triangle-height) * -1);
|
|
550
|
+
top: calc(var(--speech-triangle-height) * -1 + 1px);
|
|
551
551
|
left: 0;
|
|
552
552
|
border-right: var(--speech-triangle-width) solid transparent;
|
|
553
553
|
border-bottom: var(--speech-triangle-height) solid
|
|
@@ -3,5 +3,5 @@ export declare const SIGN_IN_URL = "https://www.ft.com/login";
|
|
|
3
3
|
export declare const SUBSCRIBE_URL = "https://subs.ft.com/products";
|
|
4
4
|
export declare const COMMUNITY_GUIDELINES_URL = "https://help.ft.com/help/article-queries/commenting-on-an-article/commenting-guidelines";
|
|
5
5
|
export declare const TERMS_AND_CONDITIONS_URL = "https://help.ft.com/help/legal-privacy/terms-conditions";
|
|
6
|
-
export declare function getTitleByUser(profile: UserDetails): "
|
|
6
|
+
export declare function getTitleByUser(profile: UserDetails): "Ask an Expert guidelines" | "You are still on a trial period" | "Asking a question is only available to readers with an FT subscription";
|
|
7
7
|
export declare function getTextByUser(profile: UserDetails): import("preact").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PRODUCT_NAME = "Ask an Expert";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/qanda-ui",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
4
|
-
"description": "Components for the Live Q&A UI",
|
|
3
|
+
"version": "0.0.1-beta.22",
|
|
4
|
+
"description": "Components for the Live Q&A (AKA Ask an Expert) UI",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|