From 562f1cdada05b6c5e0b9b0a29c4a8d5c35f4501e Mon Sep 17 00:00:00 2001 From: srosset81 Date: Fri, 17 May 2024 19:35:54 +0200 Subject: [PATCH] Show member + info on modal --- package.json | 1 + src/components/Modal.astro | 47 +++++++++++++++++++++++++ src/components/common/Members.astro | 28 ++++++++++++--- src/layouts/Layout.astro | 1 + src/pages/organisations/[...slug].astro | 8 +++-- tailwind.config.cjs | 4 +-- yarn.lock | 18 ++++++++++ 7 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 src/components/Modal.astro diff --git a/package.json b/package.json index 204d2fc..f7badff 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "astro": "^4.0.6", "astro-icon": "1.0.0-next.2", "crypto-js": "^4.1.1", + "flowbite": "^2.3.0", "isobject": "^4.0.0", "jsonld": "^5.2.0", "jwt-decode": "^3.0.0", diff --git a/src/components/Modal.astro b/src/components/Modal.astro new file mode 100644 index 0000000..35864e7 --- /dev/null +++ b/src/components/Modal.astro @@ -0,0 +1,47 @@ +--- +const { id, title } = Astro.props; +--- + + diff --git a/src/components/common/Members.astro b/src/components/common/Members.astro index cc86e57..a88ef4a 100644 --- a/src/components/common/Members.astro +++ b/src/components/common/Members.astro @@ -1,5 +1,6 @@ --- import dataProvider from '~/config/dataProvider'; +import Modal from '../Modal.astro'; export interface Props { associationsUris: string | [string]; @@ -14,12 +15,31 @@ const { data: associations } = await dataProvider.getMany('MembershipAssociation const { data: members } = await dataProvider.getMany('Person', { ids: associations.map((a) => a['pair:membershipActor']), }); + +const { data: roles } = await dataProvider.getMany('Person', { + ids: [...new Set(associations.map((a) => a['pair:membershipRole']))], +}); --- { - members?.map((member) => ( -
- {member['pair:label']} + ( +
+
+ {associations?.map((association) => { + const member = members.find((m) => m.id === association['pair:membershipActor']); + const role = roles.find((r) => r.id === association['pair:membershipRole']); + return ( +
+ + {member['pair:label']} +
{member['pair:label']}
+
{role['pair:label']}
+
+ +
+ ); + })} +
- )) + ) } diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 341cf10..51c87b9 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -50,5 +50,6 @@ const { language, textDirection } = I18N; content-visibility: auto; } + diff --git a/src/pages/organisations/[...slug].astro b/src/pages/organisations/[...slug].astro index 5268b9c..07b0ce1 100644 --- a/src/pages/organisations/[...slug].astro +++ b/src/pages/organisations/[...slug].astro @@ -67,11 +67,13 @@ const metadata = {

{organization['pair:description']}

-

Canaux de communication

+

+ Canaux de communication +

-

Membres

+

Membres

-

Projets

+

Projets

diff --git a/tailwind.config.cjs b/tailwind.config.cjs index a481b4f..49c5f1f 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -1,7 +1,7 @@ const defaultTheme = require('tailwindcss/defaultTheme'); module.exports = { - content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], + content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}', './node_modules/flowbite/**/*.js'], theme: { extend: { colors: { @@ -18,6 +18,6 @@ module.exports = { }, }, }, - plugins: [require('@tailwindcss/typography')], + plugins: [require('@tailwindcss/typography'), require('flowbite/plugin')], darkMode: 'class', }; diff --git a/yarn.lock b/yarn.lock index 7f07523..1536f60 100644 --- a/yarn.lock +++ b/yarn.lock @@ -934,6 +934,11 @@ resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.0.tgz#7d8dacb7fdef0e4387caf7396cbd77f179867d06" integrity sha512-Zwq5OCzuwJC2jwqmpEQt7Ds1DTi6BWSwoGkbb1n9pO3hzb35BoJELx7c0T23iDkBGkh2e7tvOtjF3tr3OaQHDQ== +"@popperjs/core@^2.9.3": + version "2.11.8" + resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f" + integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A== + "@rdfjs/data-model@^1.3.4": version "1.3.4" resolved "https://registry.yarnpkg.com/@rdfjs/data-model/-/data-model-1.3.4.tgz#2b1b3e52755ab1283bf66aa2d3ac97fd8a0332c2" @@ -2767,6 +2772,14 @@ flattie@^1.1.0: resolved "https://registry.yarnpkg.com/flattie/-/flattie-1.1.0.tgz#1459504209f2001c478751b4e2fb69d6b1ee3241" integrity sha512-xU99gDEnciIwJdGcBmNHnzTJ/w5AT+VFJOu6sTB6WM8diOYNA3Sa+K1DiEBQ7XH4QikQq3iFW1U+jRVcotQnBw== +flowbite@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/flowbite/-/flowbite-2.3.0.tgz#0730e35d8b0d1dcdea26bb27d848bd9c0141cde1" + integrity sha512-pm3JRo8OIJHGfFYWgaGpPv8E+UdWy0Z3gEAGufw+G/1dusaU/P1zoBLiQpf2/+bYAi+GBQtPVG86KYlV0W+AFQ== + dependencies: + "@popperjs/core" "^2.9.3" + mini-svg-data-uri "^1.4.3" + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -4473,6 +4486,11 @@ mimic-fn@^4.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== +mini-svg-data-uri@^1.4.3: + version "1.4.4" + resolved "https://registry.yarnpkg.com/mini-svg-data-uri/-/mini-svg-data-uri-1.4.4.tgz#8ab0aabcdf8c29ad5693ca595af19dd2ead09939" + integrity sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg== + minimatch@9.0.3, minimatch@^9.0.1, minimatch@^9.0.3: version "9.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825"