Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Added feature that notices without url or link will not redirect anywhere and behave like text #417

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 24 additions & 35 deletions src/components/home/notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,52 +21,42 @@ const BlinkingText = styled.span`
`

const Notice = props => {
// const newtime = new Date().getTime()

// let d = Math.round((newtime - props.time) / 3600000)
// if (d > 48) {
// d = new Date(props.time).toLocaleDateString()
// } else if (d > 24) {
// d = `${Math.round(d / 24)} days ago`
// } else if (d < 1) {
// d = `Just now`
// } else if (d < 2) {
// d = `${d} hour ago`
// } else {
// d = `${d} hours ago`
// }
return (
<>
<NoticeStyle>
<p className="noticecarddetail">
{props.imp == 1 ? <img id="flag" src={flag} alt="f" /> : ""}
{props.imp == 1 ? (
<a
href={props.link}
rel="noopener noreferrer"
target="_blank"
style={{ color: "#941b0c", fontWeight: "bold" }}
>
{" "}
<BlinkingText>{props.detail}</BlinkingText>
</a>
) : (
""
)}
{props.imp != 1 ? (
{props.imp === 1 ? <img id="flag" src={flag} alt="f" /> : ""}
{props.imp === 1 ? (
props.link ? (
<a
href={props.link}
rel="noopener noreferrer"
target="_blank"
style={{ color: "#941b0c", fontWeight: "bold" }}
>
{" "}
<BlinkingText>{props.detail}</BlinkingText>
</a>
) : (
<span style={{ color: "#941b0c", fontWeight: "bold" }}>
{" "}
<BlinkingText>{props.detail}</BlinkingText>
</span>
)
) : props.link ? (
<a href={props.link} rel="noopener noreferrer" target="_blank">
{" "}
{props.detail}
</a>
) : (
""
<span>{props.detail}</span>
)}
</p>
<div>
{props.attachments.map(elem => {
{props.attachments.map((elem, index) => {
if (elem.url)
return (
<ul>
<ul key={index}>
<img id="notdownimg" src={downimg} alt="c" />
<a
className="notdown"
Expand All @@ -80,13 +70,12 @@ const Notice = props => {
</a>
</ul>
)
return null
})}
{/* <div>
<p className="notet">{d}</p>
</div> */}
</div>
</NoticeStyle>
</>
)
}

export default Notice
Loading