mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 04:54:18 +00:00
✨ Add tweet listing box
This commit is contained in:
parent
fe7cc3573c
commit
97375bb772
10 changed files with 96 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
|||
.SummaryLeft {
|
||||
min-width: 175px;
|
||||
width: 275px;
|
||||
|
||||
display: grid;
|
||||
|
|
|
@ -6,7 +6,9 @@ import classNames from "classnames"
|
|||
export default function SummaryText({ children, className, ...props }) {
|
||||
return (
|
||||
<div className={classNames(Style.SummaryText, className)} {...props}>
|
||||
<div className={Style.Text}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
22
nest_frontend/components/base/summary/SummaryText.module.css
Normal file
22
nest_frontend/components/base/summary/SummaryText.module.css
Normal file
|
@ -0,0 +1,22 @@
|
|||
.SummaryText {
|
||||
flex-grow: 3;
|
||||
|
||||
padding: 0 0 0 20px;
|
||||
|
||||
background-color: var(--bg-light);
|
||||
|
||||
display: flex;
|
||||
justify-content: stretch;
|
||||
align-items: center;
|
||||
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.Text {
|
||||
height: 60px;
|
||||
overflow-y: auto;
|
||||
|
||||
/* Custom scrollbar (firefox only!) */
|
||||
scrollbar-color: var(--bg-accent) var(--bg-light);
|
||||
scrollbar-width: auto;
|
||||
}
|
14
nest_frontend/components/interactive/BoxRepositoryTweets.js
Normal file
14
nest_frontend/components/interactive/BoxRepositoryTweets.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import React from "react"
|
||||
import BoxFullScrollable from "../base/BoxFullScrollable"
|
||||
import SummaryTweet from "./SummaryTweet"
|
||||
|
||||
|
||||
export default function BoxRepositoryTweets({ tweets, ...props }) {
|
||||
// TODO: Translate this
|
||||
|
||||
return (
|
||||
<BoxFullScrollable header={"Tweets"} {...props}>
|
||||
{tweets.map(tweet => <SummaryTweet tweet={tweet}/>)}
|
||||
</BoxFullScrollable>
|
||||
)
|
||||
}
|
|
@ -40,7 +40,7 @@ export default function SummaryRepository(
|
|||
}
|
||||
|
||||
return (
|
||||
<SummaryBase>
|
||||
<SummaryBase {...props}>
|
||||
<SummaryLeft
|
||||
icon={repo.is_active ? faFolderOpen : faFolder}
|
||||
title={repo.name}
|
||||
|
|
32
nest_frontend/components/interactive/SummaryTweet.js
Normal file
32
nest_frontend/components/interactive/SummaryTweet.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
import React from "react"
|
||||
import SummaryBase from "../base/summary/SummaryBase"
|
||||
import SummaryLeft from "../base/summary/SummaryLeft"
|
||||
import { faComment, faMapPin } from "@fortawesome/free-solid-svg-icons"
|
||||
import SummaryText from "../base/summary/SummaryText"
|
||||
import SummaryRight from "../base/summary/SummaryRight"
|
||||
|
||||
|
||||
export default function SummaryTweet({ tweet, ...props }) {
|
||||
let icon
|
||||
if(tweet.place) {
|
||||
icon = faMapPin
|
||||
}
|
||||
else {
|
||||
icon = faComment
|
||||
}
|
||||
|
||||
return (
|
||||
<SummaryBase {...props}>
|
||||
<SummaryLeft
|
||||
icon={icon}
|
||||
title={`@${tweet.poster}`}
|
||||
subtitle={tweet.place}
|
||||
onClick={() => window.open(`https://twitter.com/${tweet.poster}/status/${tweet.snowflake}`)}
|
||||
/>
|
||||
<SummaryText>
|
||||
{tweet.content}
|
||||
</SummaryText>
|
||||
<SummaryRight/>
|
||||
</SummaryBase>
|
||||
)
|
||||
}
|
|
@ -12,7 +12,7 @@ export default function SummaryUser({ user, destroyUser, running, ...props }) {
|
|||
const { strings } = useContext(ContextLanguage)
|
||||
|
||||
return (
|
||||
<SummaryBase>
|
||||
<SummaryBase {...props}>
|
||||
<SummaryLeft
|
||||
icon={user.isAdmin ? faStar : faUser}
|
||||
title={user.username}
|
||||
|
|
|
@ -28,6 +28,10 @@ h1, h2, h3, h4, h5, h6 {
|
|||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--fg-primary)
|
||||
}
|
||||
|
||||
.ThemeDark {
|
||||
--bg-primary: #3B7097;
|
||||
--fg-primary: #FFFFFF;
|
||||
|
|
|
@ -1,13 +1,25 @@
|
|||
import React from "react"
|
||||
import Style from "./PageRepository.module.css"
|
||||
import classNames from "classnames"
|
||||
import BoxWordcloud from "../components/interactive/BoxWordcloud"
|
||||
import BoxRepositoryTweets from "../components/interactive/BoxRepositoryTweets"
|
||||
|
||||
|
||||
export default function PageRepository({ className, ...props }) {
|
||||
return (
|
||||
<div className={classNames(Style.PageRepository, className)} {...props}>
|
||||
<BoxWordcloud className={Style.Wordcloud}/>
|
||||
<BoxRepositoryTweets
|
||||
tweets={[
|
||||
{
|
||||
"conditions": [],
|
||||
"content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec posuere lacinia eleifend. Maecenas a neque augue. Nulla dapibus lobortis gravida. Quisque quis ultricies elit. Donec in tortor augue. Cras eget aliquam felis. Nunc tempor, ipsum in lobortis tristique, nunc ante velit.",
|
||||
"insert_time": "2021-05-18T18:56Z",
|
||||
"location": null,
|
||||
"place": "Casa mia",
|
||||
"poster": "USteffo",
|
||||
"snowflake": "1394698342282809344",
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
.PageRepository {
|
||||
display: grid;
|
||||
|
||||
grid-template-areas: "a";
|
||||
grid-template-areas:
|
||||
"a b"
|
||||
"c d"
|
||||
;
|
||||
|
||||
grid-gap: 10px;
|
||||
|
||||
|
|
Loading…
Reference in a new issue