Skip to content

Commit

Permalink
feat(cr): updates 20240202
Browse files Browse the repository at this point in the history
  • Loading branch information
a-buono committed Feb 2, 2024
1 parent 2af0536 commit c29f87f
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const CardCommunity: React.FC<ForumCardsI> = (props) => {
const navigate = useNavigate();

const navigateTo = () => {
navigate(`/community/${id}`);
navigate(`/forum/${id}`);
};

return (
Expand Down
18 changes: 9 additions & 9 deletions fe-piattaforma/src/components/Comments/comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface CommentI {
isAnswer?: boolean;
thread?: boolean;
noBorder?: boolean;
section: 'board' | 'community' | 'documents';
section: 'board' | 'forum' | 'documents';
onDeleteComment?: () => void;
onEditComment?: () => void;
reported: 0 | 1;
Expand Down Expand Up @@ -134,7 +134,7 @@ const Comment: React.FC<CommentI> = (props) => {
hasUserPermission([
section === 'board'
? 'del.news'
: section === 'community'
: section === 'forum'
? 'del.topic'
: section === 'documents'
? 'del.doc'
Expand All @@ -148,7 +148,7 @@ const Comment: React.FC<CommentI> = (props) => {
hasUserPermission([
section === 'board'
? 'upd.news'
: section === 'community'
: section === 'forum'
? 'upd.topic'
: section === 'documents'
? 'upd.doc'
Expand All @@ -162,7 +162,7 @@ const Comment: React.FC<CommentI> = (props) => {
hasUserPermission([
section === 'board'
? 'rprt.news'
: section === 'community'
: section === 'forum'
? 'rprt.topic'
: section === 'documents'
? 'rprt.doc'
Expand Down Expand Up @@ -327,20 +327,20 @@ const Comment: React.FC<CommentI> = (props) => {
replies={
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
section === 'community' && replies !== '[]'
section === 'forum' && replies !== '[]'
? replies?.length
: undefined
}
views={section === 'community' ? views : undefined}
views={section === 'forum' ? views : undefined}
onShowReplies={
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
section === 'community' && replies !== '[]' && replies?.length
section === 'forum' && replies !== '[]' && replies?.length
? () => setShowReplies((prev) => !prev)
: undefined
}
isReply={isReply}
showReplies={section === 'community' ? showReplies : undefined}
showReplies={section === 'forum' ? showReplies : undefined}
likes={likes}
user_like={user_like}
onLike={async () => {
Expand All @@ -355,7 +355,7 @@ const Comment: React.FC<CommentI> = (props) => {
}
}}
onComment={
section === 'community'
section === 'forum'
? () =>
dispatch(
openModal({
Expand Down
2 changes: 1 addition & 1 deletion fe-piattaforma/src/components/Comments/commentSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import SectionTitle from '../SectionTitle/sectionTitle';
import Comment from './comment';

interface commentSectionI {
section: 'board' | 'community' | 'documents';
section: 'board' | 'forum' | 'documents';
}

const CommentSection: React.FC<commentSectionI> = ({ section }) => {
Expand Down
20 changes: 10 additions & 10 deletions fe-piattaforma/src/components/DocumentDetail/sectionDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface CardDocumentDetailI {
user_like?: boolean;
likes?: number;
views?: number;
section?: 'community' | 'documents';
section?: 'forum' | 'documents';
isDocument?: boolean | undefined;
onDeleteClick?: () => void;
onEditClick?: () => void;
Expand Down Expand Up @@ -138,15 +138,15 @@ const SectionDetail: React.FC<CardDocumentDetailI> = (props) => {
hasUserPermission([
section === 'documents' || isDocument
? 'del.doc'
: section === 'community'
: section === 'forum'
? 'del.topic'
: 'hidden',
]) ||
(author?.toString() === userId?.toString() &&
hasUserPermission([
section === 'documents' || isDocument
? 'new.doc'
: section === 'community'
: section === 'forum'
? 'new.topic'
: 'hidden',
]))
Expand All @@ -157,15 +157,15 @@ const SectionDetail: React.FC<CardDocumentDetailI> = (props) => {
hasUserPermission([
section === 'documents' || isDocument
? 'upd.doc'
: section === 'community'
: section === 'forum'
? 'upd.topic'
: 'hidden',
]) ||
(author?.toString() === userId?.toString() &&
hasUserPermission([
section === 'documents' || isDocument
? 'new.doc'
: section === 'community'
: section === 'forum'
? 'new.topic'
: 'hidden',
]))
Expand All @@ -176,7 +176,7 @@ const SectionDetail: React.FC<CardDocumentDetailI> = (props) => {
hasUserPermission([
section === 'documents' || isDocument
? 'rprt.doc'
: section === 'community'
: section === 'forum'
? 'rprt.topic'
: 'hidden',
])
Expand Down Expand Up @@ -392,7 +392,7 @@ const SectionDetail: React.FC<CardDocumentDetailI> = (props) => {
</div>
) : null}
<DetailCard
isForum={section === 'community'}
isForum={section === 'forum'}
entity={entity}
entity_type={entity_type}
intervention={intervention}
Expand All @@ -406,7 +406,7 @@ const SectionDetail: React.FC<CardDocumentDetailI> = (props) => {
downloads={downloads}
user_like={user_like}
onLike={
section === 'community'
section === 'forum'
? async () => {
if (id) {
if (user_like as boolean) {
Expand All @@ -422,7 +422,7 @@ const SectionDetail: React.FC<CardDocumentDetailI> = (props) => {
})
);
}
userId && dispatch(GetItemDetail(id, userId, 'community'));
userId && dispatch(GetItemDetail(id, userId, 'forum'));
}
}
: undefined
Expand All @@ -434,7 +434,7 @@ const SectionDetail: React.FC<CardDocumentDetailI> = (props) => {
payload: {
title: 'Aggiungi commento',
action: 'comment',
entity: section === 'community' ? 'community' : 'document',
entity: section === 'forum' ? 'forum' : 'document',
category: category_label || category,
textLabel: 'Digita qui sotto il testo',
},
Expand Down
2 changes: 1 addition & 1 deletion fe-piattaforma/src/components/ReportCard/ReportCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ const ReportCard: React.FC<ReportCardI> = ({
navigate(`/bacheca/${item_id}`);
break;
case 'community_item':
navigate(`/community/${item_id}`);
navigate(`/forum/${item_id}`);
break;
case 'document_item':
navigate(`/documenti/${item_id}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ const ManageComment: React.FC<ManageCommentI> = ({
// @ts-ignore
if (res) {
userId &&
dispatch(GetItemDetail(id, userId, payload.entity || 'community'));
dispatch(GetItemDetail(id, userId, payload.entity || 'forum'));
dispatch(
ActionTracker({
target: 'tnd',
action_type: 'COMMENTO',
event_type:
payload.entity === 'board'
? 'NEWS'
: payload.entity === 'community'
: payload.entity === 'forum'
? 'TOPIC'
: 'DOCUMENTI',
category: payload.category_label || payload.category,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const ManageReport: React.FC<ManageReportI> = ({
if (newReport.trim() !== '' && payload) {
switch (payload.entity) {
case 'board':
case 'community':
case 'forum':
case 'document':
if (id && userId) {
await dispatch(CreateItemReport(id, newReport));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ const ManageTopic: React.FC<ManageTopicI> = ({
// @ts-ignore
!newFormValues?.attachment?.data,
},
'community'
'forum'
)
);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if (res) {
userId && dispatch(GetItemDetail(id, userId, 'community'));
userId && dispatch(GetItemDetail(id, userId, 'forum'));
setNewFormValues({});
setStep('confirm');
}
Expand All @@ -120,7 +120,7 @@ const ManageTopic: React.FC<ManageTopicI> = ({
? 'Ente gestore di programma'
: '-',
},
'community'
'forum'
)
);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down Expand Up @@ -170,7 +170,7 @@ const ManageTopic: React.FC<ManageTopicI> = ({
onClick: () => {
resetModal();
dispatch(closeModal());
newNodeId && navigate(`/community/${newNodeId}`);
newNodeId && navigate(`/forum/${newNodeId}`);
},
},
secondaryCTA: null,
Expand Down
3 changes: 1 addition & 2 deletions fe-piattaforma/src/pages/common/Community/community.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ const Community = () => {
<div>
<ForumLayout
title='Forum'
subtitle='Partecipa alla discussione sugli argomenti di interesse con gli altri facilitatori della
community.'
subtitle='Partecipa alla discussione sugli argomenti di interesse con gli altri facilitatori della community.'
sectionTitle='Gli argomenti più popolari'
dropdowns={dropdowns}
filtersList={{}}
Expand Down
18 changes: 9 additions & 9 deletions fe-piattaforma/src/pages/common/Community/communityDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const CommunityDetails = () => {

const getItemDetails = async () => {
if (id && userId) {
const res = await dispatch(GetItemDetail(id, userId, 'community'));
const res = await dispatch(GetItemDetail(id, userId, 'forum'));
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if (res) {
Expand All @@ -62,7 +62,7 @@ const CommunityDetails = () => {
})
);
} else {
navigate('/community', { replace: true });
navigate('/forum', { replace: true });
}
}
};
Expand All @@ -86,7 +86,7 @@ const CommunityDetails = () => {

const backButton = (
<Button
onClick={() => navigate('/community', { replace: true })}
onClick={() => navigate('/forum', { replace: true })}
className='px-0'
aria-label='vai al forum'
>
Expand All @@ -104,7 +104,7 @@ const CommunityDetails = () => {
await dispatch(DeleteComment(commentId, reason));
if (id && userId) {
dispatch(GetCommentsList(id, userId));
dispatch(GetItemDetail(id, userId, 'community'));
dispatch(GetItemDetail(id, userId, 'forum'));
}
};

Expand All @@ -120,15 +120,15 @@ const CommunityDetails = () => {
{backButton}
<SectionDetail
{...topicDetails}
section='community'
section='forum'
onDeleteClick={() =>
dispatch(
openModal({
id: 'delete-forum-entity',
payload: {
text: 'Confermi di voler eliminare questo contenuto?',
id: id,
entity: 'community',
entity: 'forum',
author: topicDetails.author,
textLabel: "Inserisci il motivo dell'eliminazione",
},
Expand All @@ -147,13 +147,13 @@ const CommunityDetails = () => {
openModal({
id: 'report-modal',
payload: {
entity: 'community',
entity: 'forum',
},
})
)
}
/>
{commentsList.length ? <CommentSection section='community' /> : null}
{commentsList.length ? <CommentSection section='forum' /> : null}
{/* <div className='border-bottom-box-comments mt-5'></div>
<div
className={clsx(
Expand All @@ -175,7 +175,7 @@ const CommunityDetails = () => {
onClose={() => dispatch(closeModal())}
onConfirm={(payload: any) => {
switch (payload.entity) {
case 'community':
case 'forum':
onEntityDelete(payload.id, payload.reason);
break;
case 'comment':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const CommunityWidget = () => {
facilitatori e formatori digitali.
</p>
{!device.mediaIsPhone && (
<Link className='btn btn-primary' role='button' to='/community'>
<Link className='btn btn-primary' role='button' to='/forum'>
Vai agli argomenti
</Link>
)}
Expand Down Expand Up @@ -134,7 +134,7 @@ const CommunityWidget = () => {
</div>
{device.mediaIsPhone && (
<div className='d-flex justify-content-center mt-5'>
<a role='button' className='btn btn-primary' href='/community'>
<a role='button' className='btn btn-primary' href='/forum'>
Esplora tutti i topic
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ const HeroHome = () => {
{'ti diamo il benvenuto su Facilita'.toUpperCase()}
</HeroTitle>
<p className='d-lg-block mt-5'>
La piattaforma dedicata alle attività di facilitazione digitale:
<strong>gestisci</strong> i servizi, <strong>monitora</strong> i
La piattaforma dedicata alle attività di facilitazione digitale: <strong>gestisci</strong> i servizi, <strong>monitora</strong> i
risultati e <strong>interagisci</strong> con la community dei
facilitatori.
</p>
Expand Down
Loading

0 comments on commit c29f87f

Please sign in to comment.