Skip to content

Commit

Permalink
feat: show only active SEs (#462)
Browse files Browse the repository at this point in the history
Co-authored-by: Gary van Woerkens <[email protected]>
  • Loading branch information
Julien Bouquillon and gary-van-woerkens authored Oct 12, 2023
1 parent 9357435 commit 1b7cf49
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 113 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_module
node_modules
.env.local
.next
.secrets.yaml
out
.vscode
8 changes: 4 additions & 4 deletions .kontinuous/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ciNamespace: ci-fabrique
dependencies:
fabrique:
extends:
- name: ovh
ifEnv: [dev,preprod]
- name: buildkit-service
ifEnv: [dev,preprod]
- name: ovh
ifEnv: [dev, preprod]
- name: buildkit-service
ifEnv: [dev, preprod]
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ Standup hebdomadaire de la fabrique des Ministères sociaux

## Fonctionnement

Toutes les infos pour mettre à jour vos informations sont [sur le wiki](https://github.com/SocialGouv/www/wiki/Inscrire-son-%C3%A9quipe-au-standup)
Toutes les infos pour mettre à jour les informations de votre startup sont [sur le wiki](https://github.com/SocialGouv/www/wiki/Inscrire-son-%C3%A9quipe-au-standup)

## Mise à jour du slide de fin

Editer le fichier [./src/slides.yml](./src/slides.yml)
Editer les sujets transverses : https://github.com/SocialGouv/standup/edit/master/src/sujets-transverses.js

Commiter puis créer une "pull request" avec votre titre adapté : `fix: modification de blabla`

Une fois la PR mergée, la modification sera envoyée en production

(le prefixe `fix: ` est important pour envoyer en prod)

(:warning: le prefixe `fix: ` est important pour envoyer en prod)
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"graphql": "^15.5.3",
"graphql-request": "^3.5.0",
"isomorphic-unfetch": "^3.1.0",
"js-yaml-loader": "^1.2.2",
"lodash": "^4.17.21",
"next": "^11.1.2",
"react": "^17.0.2",
Expand Down
2 changes: 2 additions & 0 deletions src/components/Extra.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react"
import ReactMarkdown from "react-markdown"

const Extra = ({ data }) => (
<div className="extra">
Expand All @@ -10,6 +11,7 @@ const Extra = ({ data }) => (
<p dangerouslySetInnerHTML={{ __html: entry }} />
</li>
))}
{data.markdown && <ReactMarkdown>{data.markdown}</ReactMarkdown>}
</ul>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Navigation = () => {
onKeyPress={() => slideTo(index - 1)}
>
<ChevronLeft />
{previousSlide.team.name}
{previousSlide.team?.name || previousSlide.title}
</div>
)}
</div>
Expand Down
5 changes: 0 additions & 5 deletions src/slides.yml

This file was deleted.

7 changes: 7 additions & 0 deletions src/styles/extra.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@
font-size: 1.5em;
}
}

img[alt="other-startup-logo"] {
top: 20px;
max-width: 64px;
position: relative;
display: inline-block;
}
16 changes: 16 additions & 0 deletions src/sujets-transverses.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Vous pouvez écrire du markdown
export default `
### Numérique en communs les 18/19 Octobre
### Forum BETA le 12 Octobre
---
![bon appétit](https://media.giphy.com/media/l0IykUhfRhQkCkzMk/giphy.gif)
`
48 changes: 44 additions & 4 deletions src/utils/slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,59 @@ import { request } from "graphql-request"
import { shuffle } from "lodash"
import useSWR from "swr"

import extraSlides from "../slides.yml"
import sujetsTransverses from "../sujets-transverses"

const extraSlides = [
{
markdown: sujetsTransverses,
title: "Sujets transverses",
},
]

const url = process.env.NEXT_PUBLIC_HASURA_URL

const isRecentSlide = (slide) =>
slide.created_at &&
new Date(new Date(slide.created_at).getTime() + 30 * 24 * 60 * 60 * 1000) >=
new Date()

const filterPosts = (posts) =>
posts.reduce(
(result, slide) => {
result[isRecentSlide(slide) ? "recentPosts" : "outdatedPosts"].push(slide)
return result
},
{ outdatedPosts: [], recentPosts: [] }
)

const addOutdatedPostsSlideToExtraSlides = (posts) =>
extraSlides.unshift({
markdown: shuffle(posts)
.map(
(post) =>
`### ![other-startup-logo](${post.team?.avatarUrl}) ${post.team?.name}`
)
.join("\n"),
title: "Les autres startups",
})

const fetcher = async (query) => {
const { posts } = await request(url, query)
const filteredPosts =
const visiblePosts =
posts &&
posts.filter(
(slide) =>
slide.team && !slide.team.parentTeam && slide.team.privacy === "VISIBLE"
slide.team &&
slide.created_at &&
!slide.team.parentTeam &&
slide.team.privacy === "VISIBLE"
)
const slides = filteredPosts && [...shuffle(filteredPosts), ...extraSlides]
const { recentPosts, outdatedPosts } = filterPosts(visiblePosts)

addOutdatedPostsSlideToExtraSlides(outdatedPosts)

const slides = recentPosts && [...shuffle(recentPosts), ...extraSlides]

return Promise.resolve(slides)
}

Expand Down
Loading

0 comments on commit 1b7cf49

Please sign in to comment.