-
-
Notifications
You must be signed in to change notification settings - Fork 152
docs: add SocialShareButton tutorial video to README #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,15 +1,31 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import React, { useMemo } from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "use client"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import React, { useMemo, useEffect } from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import "./Footer.css"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { FaLinkedinIn, FaGithub } from "react-icons/fa"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { BsTwitterX } from "react-icons/bs"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const Footer = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const currentYear = useMemo(() => new Date().getFullYear(), []); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const interval = setInterval(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (typeof window !== "undefined" && window.SocialShareButton) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| new window.SocialShareButton({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| container: "#share-button", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| url: "https://aossie.org", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| title: "Check out AOSSIE!" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+15
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Share payload is hardcoded to a different site. The widget currently shares 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| clearInterval(interval); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, 300); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return () => clearInterval(interval); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, []); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Polling is unbounded if the external script never becomes available. If Proposed reliability fix useEffect(() => {
- const interval = setInterval(() => {
+ let attempts = 0;
+ const maxAttempts = 20; // ~6s at 300ms
+ const interval = setInterval(() => {
+ attempts += 1;
if (typeof window !== "undefined" && window.SocialShareButton) {
new window.SocialShareButton({
container: "#share-button",
url: "https://aossie.org",
title: "Check out AOSSIE!"
});
clearInterval(interval);
+ return;
}
+ if (attempts >= maxAttempts) clearInterval(interval);
}, 300);
return () => clearInterval(interval);
}, []);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <footer className="footer"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="footer-container"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="copyright">© {currentYear}</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="footer-socials"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| href="https://github.com/AOSSIE-Org" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -36,9 +52,12 @@ const Footer = () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <FaLinkedinIn /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </a> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {/* 🔥 Share Button */} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div id="share-button" style={{ marginTop: "1rem" }}></div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </footer> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default React.memo(Footer); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default React.memo(Footer); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ import { Raleway } from "next/font/google"; | |
| import "./globals.css"; | ||
| import NavBar from "./components/Layout/NavBar"; | ||
| import Footer from "./components/Layout/Footer"; | ||
| import Script from "next/script"; | ||
|
|
||
| const raleway = Raleway({ | ||
| subsets: ["latin"], | ||
|
|
@@ -25,11 +26,26 @@ export const metadata = { | |
| export default function RootLayout({ children }) { | ||
| return ( | ||
| <html lang="en"> | ||
| <head> | ||
| {/* ✅ SocialShareButton CSS */} | ||
| <link | ||
| rel="stylesheet" | ||
| href="https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.css" | ||
| /> | ||
|
Comment on lines
+31
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
css_url="https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.css"
js_url="https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.js"
for url in "$css_url" "$js_url"; do
echo "URL: $url"
hash=$(curl -fsSL "$url" | openssl dgst -sha384 -binary | openssl base64 -A)
echo "integrity=\"sha384-$hash\""
echo
doneRepository: AOSSIE-Org/Resonate-Website Length of output: 327 🏁 Script executed: cat -n app/layout.js | sed -n '25,55p'Repository: AOSSIE-Org/Resonate-Website Length of output: 905 🏁 Script executed: # Search for all external CDN links in the layout file
rg 'href=|src=' app/layout.js -A 2 -B 1Repository: AOSSIE-Org/Resonate-Website Length of output: 406 🏁 Script executed: # Try to fetch the CSS/JS files and generate SRI using Python
python3 << 'EOF'
import hashlib
import base64
import urllib.request
urls = [
"https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.css",
"https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.js"
]
for url in urls:
try:
with urllib.request.urlopen(url, timeout=10) as response:
content = response.read()
hash_obj = hashlib.sha384(content)
integrity = "sha384-" + base64.b64encode(hash_obj.digest()).decode('ascii')
print(f"URL: {url}")
print(f'integrity="{integrity}"')
print()
except Exception as e:
print(f"Error fetching {url}: {e}")
print()
EOFRepository: AOSSIE-Org/Resonate-Website Length of output: 555 🌐 Web query:
💡 Result: The Next.js Script component (next/script) does not have a built-in integrity prop listed in the official documentation. Official docs for Script component props include src, strategy, onLoad, onReady, onError, etc., but no integrity. However, it supports additional arbitrary HTML attributes (like nonce, data-), which are forwarded to the underlying <script> element. You can manually add integrity="sha256-..." to external third-party scripts for SRI support. Next.js has experimental.sri support (next.config.js: experimental: { sri: { algorithm: 'sha256' } }) that automatically adds integrity attributes to its own internal static chunks (e.g., _next/static/chunks/) in App Router builds, generating a subresource-integrity-manifest.json. This works for Node.js and Edge runtimes but has limitations: missing for some client chunks ('use client'), stylesheets, and mismatches with CDN compression (open issues as of 2026). It does not apply to Script component-loaded third-party scripts. For complete SRI: - Manual for third-party via Script: <Script src="..." integrity="sha256-ABC123" crossorigin="anonymous" /> - Automatic (experimental, incomplete) for Next.js bundles via config. Citations:
Add SRI integrity attributes to third-party CDN assets. External CSS and JavaScript from jsdelivr are loaded without integrity verification, creating a supply-chain risk. Add Example for Script component<Script
src="https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.js"
integrity="sha384-[hash-here]"
crossOrigin="anonymous"
strategy="afterInteractive"
/>Generate SRI hashes using: 🤖 Prompt for AI Agents |
||
| </head> | ||
|
|
||
| <body className={raleway.className}> | ||
| <NavBar /> | ||
| {children} | ||
| <Footer /> | ||
|
|
||
| {/* ✅ Load JS */} | ||
| <Script | ||
| src="https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.js" | ||
| strategy="afterInteractive" | ||
| /> | ||
|
|
||
| </body> | ||
| </html> | ||
| ); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR closure target appears mismatched with linked issue objective.
This change documents SocialShareButton, but the linked Issue
#19objective is mobile navigation (hamburger/menu accessibility). Please avoid auto-closing that issue from this PR unless the nav requirements are implemented here.🤖 Prompt for AI Agents