META-INF.resources.js.pages.questions.components.QuestionList.es.js Maven / Gradle / Ivy
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
import ClayButton from '@clayui/button';
import ClayEmptyState from '@clayui/empty-state';
import ClayIcon from '@clayui/icon';
import React from 'react';
import Alert from '../../../components/Alert.es';
import PaginatedList from '../../../components/PaginatedList.es';
import QuestionRow from '../../../components/QuestionRow.es';
import lang from '../../../utils/lang.es';
import {getFullPath} from '../../../utils/utils.es';
const QuestionList = ({
buildParams,
changePage,
context,
creatorId,
error,
historyPushParser,
loading,
navigateToNewQuestion,
page,
pageSize,
questions,
search,
section,
sectionTitle,
urlParams = {},
}) => {
if (section) {
return (
changePage({...urlParams, page, pageSize, search})
}
data={questions}
emptyState={
sectionTitle && !search ? (
{((context.redirectToLogin &&
!themeDisplay.isSignedIn()) ||
context.canCreateThread) && (
{Liferay.Language.get('ask-question')}
)}
) : (
)
}
hrefConstructor={(page) =>
`${getFullPath('questions')}${
context.historyRouterBasePath ? '' : '#/'
}questions/${sectionTitle}?${buildParams({
...urlParams,
page,
})}`
}
loading={loading}
totalCount={questions.totalCount}
>
{(question) => (
)}
{Liferay.Language.get('ask-question')}
);
}
return (
historyPushParser('/questions')}
>
{Liferay.Language.get('home')}
);
};
export default QuestionList;