Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
AareFabrik committed Feb 4, 2025
1 parent cc08adc commit fceb1ec
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 11 deletions.
35 changes: 34 additions & 1 deletion next/app/(main)/beitraege/PostList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useInView } from "react-intersection-observer";
import Colors from "@/lib/Colors";
import Loader from "react-spinners/ClipLoader";

const NUMBER_OF_POSTS_TO_FETCH = 3;
const NUMBER_OF_POSTS_TO_FETCH = 6;

export default function PostList({ initialPosts, filters }) {
const [offset, setOffset] = useState(NUMBER_OF_POSTS_TO_FETCH);
Expand All @@ -37,6 +37,13 @@ export default function PostList({ initialPosts, filters }) {
}
}, [inView]);

useEffect(() => {
if (inView) {
setIsloading(true);
loadMoreUsers();
}
}, []);

useEffect(() => {
if (initialPosts !== posts) {
setOffset(NUMBER_OF_POSTS_TO_FETCH);
Expand Down Expand Up @@ -121,6 +128,32 @@ export default function PostList({ initialPosts, filters }) {
</Text>
</View>
)}
{allPostsFetched && (
<View
style={[
{
alignSelf: "flex-start",
flexDirection: "row",
alignItems: "center",
paddingVertical: 3,
paddingHorizontal: 6,
marginTop: Metrics.tripleBaseMargin,
},
]}
>
<Text
style={[
{
...Fonts.style.h4,
flexShrink: 1,
marginLeft: Metrics.halfHalfBaseMargin,
},
]}
>
{"Mehr Beiträge haben wir nicht gefunden."}
</Text>
</View>
)}
</div>
</>
);
Expand Down
20 changes: 20 additions & 0 deletions next/app/(main)/beitraege/getPosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ export const getPosts = async (filters, offset, limit) => {
: undefined,
},
},
{
authors: {
directus_users_id: {
first_name: {
_icontains: filters.searchTerm
? filters.searchTerm
: undefined,
},
},
},
},
{
program: {
name: {
_icontains: filters.searchTerm
? filters.searchTerm
: undefined,
},
},
},
],
},
],
Expand Down
2 changes: 1 addition & 1 deletion next/app/(main)/beitraege/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function getAuthor(id) {
export const metadata: Metadata = {
title: "Beiträge",
};
const INITIAL_NUMBER_OF_POSTS = 3;
const INITIAL_NUMBER_OF_POSTS = 6;

export default async function BeitraegePage({ searchParams }) {
// Extract filters from searchParams
Expand Down
13 changes: 6 additions & 7 deletions next/app/(main)/beitrag/[date]/[postslug]/PagePost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function BeitragPage({ post, morePosts }: Props) {
if (user.last_name && user.last_name !== "") {
userName = userName + " " + user.last_name;
}
userName = userName.trim();

return (
<ButtonText
Expand Down Expand Up @@ -91,13 +92,7 @@ export default function BeitragPage({ post, morePosts }: Props) {
{`${moment(post.date_published).format("D. MMMM YYYY")}`}
</Text>
</View>
<Text
// dataSet={{media:ids.}}
style={{
...Fonts.style.h1,
paddingBottom: Metrics.tripleBaseMargin,
}}
>
<Text dataSet={{ media: ids.postTitle }} style={styles.postTitle}>
{post.title}
</Text>
{imagebox && (
Expand Down Expand Up @@ -212,6 +207,10 @@ const { ids, styles } = StyleSheet.create({
width: "90%",
},
},
postTitle: {
...Fonts.style.h1,
paddingBottom: Metrics.tripleBaseMargin,
},
postInfoContainer: {
flexDirection: "row",
alignItems: "center",
Expand Down
2 changes: 1 addition & 1 deletion next/components/PostPreview/PostPreviewBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const PostPreviewBox = ({ posts }: Props) => {
href={`/beitrag/${moment(item.date_published).format("DD-MM-YYYY")}/${item.slug}`}
style={{
textDecoration: "none",
overflow: "hidden",
// overflow: "hidden",
}}
>
{item.preview_full_image ? (
Expand Down
1 change: 0 additions & 1 deletion next/lib/Fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const style: Record<string, TextStyle> = {
fontFamily: type.bold,
fontSize: size.h1,
lineHeight: 56.4,
// letterSpacing: 0,
fontFeatureSettings: '"tnum" on',
"@media (max-width: 910px)": {
fontSize: 42,
Expand Down

0 comments on commit fceb1ec

Please sign in to comment.