diff --git a/samples/react-modern-birthdays/.devcontainer/devcontainer.json b/samples/react-modern-birthdays/.devcontainer/devcontainer.json new file mode 100644 index 000000000..d0df53099 --- /dev/null +++ b/samples/react-modern-birthdays/.devcontainer/devcontainer.json @@ -0,0 +1,39 @@ +// For more information on how to run this SPFx project in a VS Code Remote Container, please visit https://aka.ms/spfx-devcontainer +{ + "name": "SPFx 1.16.1", + "image": "docker.io/m365pnp/spfx:1.16.1", + // Set *default* container specific settings.json values on container create. + "settings": {}, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "editorconfig.editorconfig", + "dbaeumer.vscode-eslint" + ], + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 4321, + 35729 + ], + "portsAttributes": { + "4321": { + "protocol": "https", + "label": "Manifest", + "onAutoForward": "silent", + "requireLocalPort": true + }, + // Not needed for SPFx>= 1.12.1 + // "5432": { + // "protocol": "https", + // "label": "Workbench", + // "onAutoForward": "silent" + // }, + "35729": { + "protocol": "https", + "label": "LiveReload", + "onAutoForward": "silent", + "requireLocalPort": true + } + }, + "postCreateCommand": "bash .devcontainer/spfx-startup.sh", + "remoteUser": "node" +} \ No newline at end of file diff --git a/samples/react-modern-birthdays/.devcontainer/spfx-startup.sh b/samples/react-modern-birthdays/.devcontainer/spfx-startup.sh new file mode 100644 index 000000000..456d6aea8 --- /dev/null +++ b/samples/react-modern-birthdays/.devcontainer/spfx-startup.sh @@ -0,0 +1,33 @@ +echo +echo -e "\e[1;94mInstalling Node dependencies\e[0m" +npm install + +## commands to create dev certificate and copy it to the root folder of the project +echo +echo -e "\e[1;94mGenerating dev certificate\e[0m" +gulp trust-dev-cert + +# Convert the generated PEM certificate to a CER certificate +openssl x509 -inform PEM -in ~/.rushstack/rushstack-serve.pem -outform DER -out ./spfx-dev-cert.cer + +# Copy the PEM ecrtificate for non-Windows hosts +cp ~/.rushstack/rushstack-serve.pem ./spfx-dev-cert.pem + +## add *.cer to .gitignore to prevent certificates from being saved in repo +if ! grep -Fxq '*.cer' ./.gitignore + then + echo "# .CER Certificates" >> .gitignore + echo "*.cer" >> .gitignore +fi + +## add *.pem to .gitignore to prevent certificates from being saved in repo +if ! grep -Fxq '*.pem' ./.gitignore + then + echo "# .PEM Certificates" >> .gitignore + echo "*.pem" >> .gitignore +fi + +echo +echo -e "\e[1;92mReady!\e[0m" + +echo -e "\n\e[1;94m**********\nOptional: if you plan on using gulp serve, don't forget to add the container certificate to your local machine. Please visit https://aka.ms/spfx-devcontainer for more information\n**********" \ No newline at end of file diff --git a/samples/react-modern-birthdays/README.md b/samples/react-modern-birthdays/README.md index b67e0369f..53b262b06 100644 --- a/samples/react-modern-birthdays/README.md +++ b/samples/react-modern-birthdays/README.md @@ -1,9 +1,8 @@ # Birthdays and Birthdays Timeline ## Summary -The Web Part(s) shows the upcoming birthdays in the company, the web parts reads birthdays from a list located on the tenant's root site with title "Birthdays." - +The Web Part(s) shows the upcoming birthdays in the company, the web parts reads birthdays from a list located on the tenant's root site with title "Birthdays." ![Birthdays Web Part](./src/assets/birthdays.png) ![Birthdays Web Part](./src/assets/birthdays_teams.jpg) @@ -11,9 +10,8 @@ The Web Part(s) shows the upcoming birthdays in the company, the web parts read ## Compatibility ![SPFx 1.16.1](https://img.shields.io/badge/SPFx-1.16.1-green.svg) -![Node.js v16 | v14](https://img.shields.io/badge/Node.js-v16%20|%20v14-green.svg) +![Node.js v16 | v14](https://img.shields.io/badge/Node.js-v16%20|%20v14-green.svg) ![SharePoint Online](https://img.shields.io/badge/SharePoint-Online-yellow.svg) - ![Workbench Hosted: Does not work with local workbench](https://img.shields.io/badge/Workbench-Hosted-yellow.svg "Does not work with local workbench") ![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg) @@ -22,9 +20,8 @@ The Web Part(s) shows the upcoming birthdays in the company, the web parts read * [SharePoint Framework](https://learn.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview) * [Microsoft 365 tenant](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-development-environment) - ## Prerequisites - + Existing list in tenant root site, with the Title "Birthdays" and columns: Column Internal Name|Type|Required| comments @@ -37,56 +34,53 @@ email | Text | true > **IMPORTANT:** Create index on column "Birthday". -## Solution +## Authors -Solution|Author(s) ---------|--------- -react Modern Birthday Web Part|[João Mendes](https://github.com/joaojmendes) - +[João Mendes](https://github.com/joaojmendes) ## Version history Version|Date|Comments -------|----|-------- 1.0.0|January 31, 2023|Initial release - ## Minimal Path to Awesome -- Clone this repository -- in the command line run: - - `npm install` - - `gulp build` - - `gulp bundle --ship` - - `gulp package-solution --ship` - - Add and Deploy Package to AppCatalog - - Go to API Management - from SharePoint Admin Center new experience, and Approve the Permission Require to Use Graph API SCOPES - -> This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit https://aka.ms/spfx-devcontainer for further instructions. +* Clone this repository +* in the command line run: + * `npm install` + * `gulp build` + * `gulp bundle --ship` + * `gulp package-solution --ship` + * Add and Deploy Package to AppCatalog + * Go to API Management - from SharePoint Admin Center new experience, and Approve the Permission Require to Use Graph API SCOPES +> This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit for further instructions. ## Features + This project contains sample Birthday web parts built on the SharePoint Framework using React and an Azure Function to get user Birthdays from AAD. This sample illustrates the following concepts on top of the SharePoint Framework: -- using React for building SharePoint Framework client-side web parts -- using React components for building Birthday web part -- using MSGraph API to get data from SharePoint Lists -- using MSGraph API to read users from AAD -- Using React Hooks -- using Global State Management (JOTAI) -- using localStorage -- using Fluent UI FrameWork -- + +* using React for building SharePoint Framework client-side web parts +* using React components for building Birthday web part +* using MSGraph API to get data from SharePoint Lists +* using MSGraph API to read users from AAD +* Using React Hooks +* using Global State Management (JOTAI) +* using localStorage +* using Fluent UI FrameWork +* ## References - -- [Getting started with SharePoint Framework](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-developer-tenant) -- [Building for Microsoft teams](https://learn.microsoft.com/sharepoint/dev/spfx/build-for-teams-overview) -- [Use Microsoft Graph in your solution](https://learn.microsoft.com/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis) -- [Publish SharePoint Framework applications to the Marketplace](https://learn.microsoft.com/sharepoint/dev/spfx/publish-to-marketplace-overview) -- [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - Guidance, tooling, samples and open-source controls for your Microsoft 365 development -- [Fluent UI version 9](https://github.com/microsoft/fluentui/tree/master/packages/react-components) - Converged Fluent UI components + +* [Getting started with SharePoint Framework](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-developer-tenant) +* [Building for Microsoft teams](https://learn.microsoft.com/sharepoint/dev/spfx/build-for-teams-overview) +* [Use Microsoft Graph in your solution](https://learn.microsoft.com/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis) +* [Publish SharePoint Framework applications to the Marketplace](https://learn.microsoft.com/sharepoint/dev/spfx/publish-to-marketplace-overview) +* [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - Guidance, tooling, samples and open-source controls for your Microsoft 365 development +* [Fluent UI version 9](https://github.com/microsoft/fluentui/tree/master/packages/react-components) - Converged Fluent UI components ## Help @@ -100,11 +94,8 @@ For questions regarding this sample, [create a new question](https://github.com/ Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement%2Csample%3A%20react-birthdays&template=question.yml&sample=react-birthdays&authors=@smaity%20@joaojmendes&title=react-birthdays%20-%20). - ## Disclaimer **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** - - diff --git a/samples/react-modern-birthdays/assets/birthdays.png b/samples/react-modern-birthdays/assets/birthdays.png new file mode 100644 index 000000000..a9c5adfe0 Binary files /dev/null and b/samples/react-modern-birthdays/assets/birthdays.png differ diff --git a/samples/react-modern-birthdays/assets/birthdays_teams.jpg b/samples/react-modern-birthdays/assets/birthdays_teams.jpg new file mode 100644 index 000000000..38f000209 Binary files /dev/null and b/samples/react-modern-birthdays/assets/birthdays_teams.jpg differ diff --git a/samples/react-modern-birthdays/assets/sample.json b/samples/react-modern-birthdays/assets/sample.json new file mode 100644 index 000000000..38315ef6e --- /dev/null +++ b/samples/react-modern-birthdays/assets/sample.json @@ -0,0 +1,98 @@ +[ + { + "name": "pnp-sp-dev-spfx-web-parts-react-modern-birthdays-timeline", + "source": "pnp", + "title": "Birthdays Timeline", + "shortDescription": "Shows upcoming birthdays in the company in a timeline", + "url": "https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-modern-birthdays", + "downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-modern-birthdays", + "longDescription": [ + "Shows upcoming birthdays in the company, laid out in a timeline" + ], + "creationDateTime": "2023-01-31", + "updateDateTime": "2023-01-31", + "products": [ + "SharePoint" + ], + "metadata": [ + { + "key": "CLIENT-SIDE-DEV", + "value": "React" + }, + { + "key": "SPFX-VERSION", + "value": "1.16.1" + } + ], + "thumbnails": [ + { + "type": "image", + "order": 100, + "url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/react-modern-birthdays/assets/birthdays.png", + "alt": "Web Part Preview" + } + ], + "authors": [ + { + "gitHubAccount": "joaojmendes", + "pictureUrl": "https://github.com/joaojmendes.png", + "name": "João Mendes" + } + ], + "references": [ + { + "name": "Build your first SharePoint client-side web part", + "description": "Client-side web parts are client-side components that run in the context of a SharePoint page. Client-side web parts can be deployed to SharePoint environments that support the SharePoint Framework. You can also use modern JavaScript web frameworks, tools, and libraries to build them.", + "url": "https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part" + } + ] + }, + { + "name": "pnp-sp-dev-spfx-web-parts-react-modern-birthdays", + "source": "pnp", + "title": "Birthdays", + "shortDescription": "Shows upcoming birthdays in the company", + "url": "https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-modern-birthdays", + "downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-modern-birthdays", + "longDescription": [ + "The Web Part shows the upcoming birthdays in the company, the web parts reads birthdays from a list located on the tenant's root site with title \"Birthdays.\"" + ], + "creationDateTime": "2023-01-31", + "updateDateTime": "2023-01-31", + "products": [ + "SharePoint" + ], + "metadata": [ + { + "key": "CLIENT-SIDE-DEV", + "value": "React" + }, + { + "key": "SPFX-VERSION", + "value": "1.16.1" + } + ], + "thumbnails": [ + { + "type": "image", + "order": 100, + "url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/react-modern-birthdays/assets/birthdays_teams.jpg", + "alt": "Web Part Preview" + } + ], + "authors": [ + { + "gitHubAccount": "joaojmendes", + "pictureUrl": "https://github.com/joaojmendes.png", + "name": "João Mendes" + } + ], + "references": [ + { + "name": "Build your first SharePoint client-side web part", + "description": "Client-side web parts are client-side components that run in the context of a SharePoint page. Client-side web parts can be deployed to SharePoint environments that support the SharePoint Framework. You can also use modern JavaScript web frameworks, tools, and libraries to build them.", + "url": "https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part" + } + ] + } +] \ No newline at end of file