Skip to content

Commit

Permalink
add notInteractive to articles
Browse files Browse the repository at this point in the history
  • Loading branch information
xtian7489 committed Aug 27, 2024
1 parent a1ece80 commit 1ad4754
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
3 changes: 0 additions & 3 deletions src/app/pacto/[id]/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@ import { Suspense } from "react";
export default async function Propuesta({params:{id}, searchParams:{version}}) {
const project = await fetchProjectId(id,version)
if (project) return (<div className="pacto-wrapper ">
<Suspense fallback={<Skeleton height={700} column/>}>
<BreadcrumbNav project={project} section="resumen" version={version}/>
<HeaderPropuesta project={project} section="resumen" />
<div className="project-body-container">
<ResumenBody project={project} />
</div>

</Suspense>
</div>)
else return (<div className="content pacto-wrapper has-text-centered">
<h1 className='my-6'>Todavia no hay pacto</h1>
Expand Down
7 changes: 3 additions & 4 deletions src/components/pacto/body/pacto/article.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default function Article({ project, article }) {
const [dislikes, setDislikes] = useState(article.dislikes);
const [showComments, setShowComments] = useState(false);
const { language } = useLanguage();

const handleLike = async () => {
const resp = await toLike(
`/projects/${project._id}/articles/${article._id}`
Expand Down Expand Up @@ -60,7 +59,7 @@ export default function Article({ project, article }) {
return (
<div className="columns mx-0 article my-4">
<div className="column is-11 is-12-touch">
<div className="card card-article">
<div className={"card " + (article.notInteractive ? "card-article-title" : "card-article")}>
<div className="card-content is-size-5 columns mx-0">
<div className="content w-100 is-size-7-touch">
<Remark>
Expand All @@ -70,7 +69,7 @@ export default function Article({ project, article }) {
</Remark>
</div>
</div>
<footer
{!article.notInteractive && <footer
className={`card-footer has-background-primary is-flex is-justify-content-space-between is-relative ${
project.version !== project.currentVersion
? "disabled"
Expand Down Expand Up @@ -142,7 +141,7 @@ export default function Article({ project, article }) {
<FontAwesomeIcon icon={faComment} /> Comentar
</button>
</div>
</footer>
</footer>}
</div>
</div>
{showComments && (
Expand Down
9 changes: 8 additions & 1 deletion src/components/pacto/form/articleForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const ArticleForm = forwardRef(({ article, moveArticleUp, moveArticleDown, toggl
const [articleId] = useState(article._id || null);
const [text_es, setText_es] = useState(article.text_es || '');
const [text_pt, setText_pt] = useState(article.text_pt || '');
const [notInteractive, setNotIteractive] = useState(article.notInteractive || false)

// const [position, setPosition] = useState(article.position || 1);
const summary_es_ref = useRef(null);
const summary_pt_ref = useRef(null);
Expand All @@ -31,6 +33,7 @@ const ArticleForm = forwardRef(({ article, moveArticleUp, moveArticleDown, toggl
}
if(deleted) output.deleted = true
if(articleId) output._id = articleId
output.notInteractive = notInteractive
return output
},
getCurrentTextEs() {
Expand Down Expand Up @@ -66,12 +69,17 @@ const ArticleForm = forwardRef(({ article, moveArticleUp, moveArticleDown, toggl
setDeleted(!deleted)
}


return (
<div className='article-wrapper'>
<div className='mb-4'>
<div className="is-flex is-justify-content-space-between is-align-items-center is-justify-content-top">
<h3 className="title is-5 mb-0">Artículo {!articleId && <span className="tag is-primary">Nuevo</span> }</h3>
<div className="is-flex">
<label className="checkbox mr-4">
<input type="checkbox" checked={!notInteractive} onChange={()=>setNotIteractive(!notInteractive)} />
Interactivo
</label>
<div className="is-clickable"><FontAwesomeIcon className="" icon={faCaretSquareUp} onClick={clickArticleUp}/></div>
<div className="is-clickable ml-4"><FontAwesomeIcon className="" icon={faSquareCaretDown} onClick={clickArticleDown} /></div>
{
Expand All @@ -98,6 +106,5 @@ const ArticleForm = forwardRef(({ article, moveArticleUp, moveArticleDown, toggl
)
})

ArticleForm.displayName = 'ArticleForm';

export default ArticleForm;
1 change: 1 addition & 0 deletions src/components/pacto/form/projectForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default function ProjectFormComponent({project, newVersion}) {
clientId: getRandomClientId(),
text_es: article.text_es,
text_pt: article.text_pt,
notInteractive: article.notInteractive,
}
})
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/pacto/header/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import UserAvatar from "../../common/user-avatar";
import ClosingDate from "../../common/closing-date";
import ArticlesCommentsCounter from "../../common/article-comment-counter";
import ProjectHeaderVersion from "../../common/project-version";
import ProgressBar from "../../common/progresBar";
import ClosingProject from "../../common/closing-project";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faShareNodes } from "@fortawesome/free-solid-svg-icons";
import Link from "next/link";
import StageProject from "@/components/common/stage-project";
Expand Down
4 changes: 4 additions & 0 deletions src/static/scss/pacto.scss
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@
}

.article {
.card-article-title {
border: none!important;
box-shadow: none!important;
}
.card-article {
.card-footer {
padding: 0.5rem 1rem;
Expand Down

0 comments on commit 1ad4754

Please sign in to comment.