This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

add supabase

+170
+6
lib/supabase.js
··· 1 + import { createClient } from '@supabase/supabase-js' 2 + 3 + const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL 4 + const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY 5 + 6 + export const supabase = createClient(supabaseUrl, supabaseAnonKey)
+124
package-lock.json
··· 14 14 "@atproto/oauth-client-node": "^0.2.4", 15 15 "@fortawesome/free-solid-svg-icons": "^6.7.2", 16 16 "@fortawesome/react-fontawesome": "^0.2.2", 17 + "@supabase/supabase-js": "^2.48.1", 17 18 "@vercel/analytics": "^1.5.0", 18 19 "@vercel/edge": "^1.2.1", 19 20 "axios": "^1.7.9", ··· 3674 3675 "@sinonjs/commons": "^1.7.0" 3675 3676 } 3676 3677 }, 3678 + "node_modules/@supabase/auth-js": { 3679 + "version": "2.67.3", 3680 + "resolved": "https://registry.npmjs.org/@supabase/auth-js/-/auth-js-2.67.3.tgz", 3681 + "integrity": "sha512-NJDaW8yXs49xMvWVOkSIr8j46jf+tYHV0wHhrwOaLLMZSFO4g6kKAf+MfzQ2RaD06OCUkUHIzctLAxjTgEVpzw==", 3682 + "license": "MIT", 3683 + "dependencies": { 3684 + "@supabase/node-fetch": "^2.6.14" 3685 + } 3686 + }, 3687 + "node_modules/@supabase/functions-js": { 3688 + "version": "2.4.4", 3689 + "resolved": "https://registry.npmjs.org/@supabase/functions-js/-/functions-js-2.4.4.tgz", 3690 + "integrity": "sha512-WL2p6r4AXNGwop7iwvul2BvOtuJ1YQy8EbOd0dhG1oN1q8el/BIRSFCFnWAMM/vJJlHWLi4ad22sKbKr9mvjoA==", 3691 + "license": "MIT", 3692 + "dependencies": { 3693 + "@supabase/node-fetch": "^2.6.14" 3694 + } 3695 + }, 3696 + "node_modules/@supabase/node-fetch": { 3697 + "version": "2.6.15", 3698 + "resolved": "https://registry.npmjs.org/@supabase/node-fetch/-/node-fetch-2.6.15.tgz", 3699 + "integrity": "sha512-1ibVeYUacxWYi9i0cf5efil6adJ9WRyZBLivgjs+AUpewx1F3xPi7gLgaASI2SmIQxPoCEjAsLAzKPgMJVgOUQ==", 3700 + "license": "MIT", 3701 + "dependencies": { 3702 + "whatwg-url": "^5.0.0" 3703 + }, 3704 + "engines": { 3705 + "node": "4.x || >=6.0.0" 3706 + } 3707 + }, 3708 + "node_modules/@supabase/node-fetch/node_modules/tr46": { 3709 + "version": "0.0.3", 3710 + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", 3711 + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", 3712 + "license": "MIT" 3713 + }, 3714 + "node_modules/@supabase/node-fetch/node_modules/webidl-conversions": { 3715 + "version": "3.0.1", 3716 + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", 3717 + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", 3718 + "license": "BSD-2-Clause" 3719 + }, 3720 + "node_modules/@supabase/node-fetch/node_modules/whatwg-url": { 3721 + "version": "5.0.0", 3722 + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", 3723 + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", 3724 + "license": "MIT", 3725 + "dependencies": { 3726 + "tr46": "~0.0.3", 3727 + "webidl-conversions": "^3.0.0" 3728 + } 3729 + }, 3730 + "node_modules/@supabase/postgrest-js": { 3731 + "version": "1.18.1", 3732 + "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.18.1.tgz", 3733 + "integrity": "sha512-dWDnoC0MoDHKhaEOrsEKTadWQcBNknZVQcSgNE/Q2wXh05mhCL1ut/jthRUrSbYcqIw/CEjhaeIPp7dLarT0bg==", 3734 + "license": "MIT", 3735 + "dependencies": { 3736 + "@supabase/node-fetch": "^2.6.14" 3737 + } 3738 + }, 3739 + "node_modules/@supabase/realtime-js": { 3740 + "version": "2.11.2", 3741 + "resolved": "https://registry.npmjs.org/@supabase/realtime-js/-/realtime-js-2.11.2.tgz", 3742 + "integrity": "sha512-u/XeuL2Y0QEhXSoIPZZwR6wMXgB+RQbJzG9VErA3VghVt7uRfSVsjeqd7m5GhX3JR6dM/WRmLbVR8URpDWG4+w==", 3743 + "license": "MIT", 3744 + "dependencies": { 3745 + "@supabase/node-fetch": "^2.6.14", 3746 + "@types/phoenix": "^1.5.4", 3747 + "@types/ws": "^8.5.10", 3748 + "ws": "^8.18.0" 3749 + } 3750 + }, 3751 + "node_modules/@supabase/realtime-js/node_modules/ws": { 3752 + "version": "8.18.0", 3753 + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", 3754 + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", 3755 + "license": "MIT", 3756 + "engines": { 3757 + "node": ">=10.0.0" 3758 + }, 3759 + "peerDependencies": { 3760 + "bufferutil": "^4.0.1", 3761 + "utf-8-validate": ">=5.0.2" 3762 + }, 3763 + "peerDependenciesMeta": { 3764 + "bufferutil": { 3765 + "optional": true 3766 + }, 3767 + "utf-8-validate": { 3768 + "optional": true 3769 + } 3770 + } 3771 + }, 3772 + "node_modules/@supabase/storage-js": { 3773 + "version": "2.7.1", 3774 + "resolved": "https://registry.npmjs.org/@supabase/storage-js/-/storage-js-2.7.1.tgz", 3775 + "integrity": "sha512-asYHcyDR1fKqrMpytAS1zjyEfvxuOIp1CIXX7ji4lHHcJKqyk+sLl/Vxgm4sN6u8zvuUtae9e4kDxQP2qrwWBA==", 3776 + "license": "MIT", 3777 + "dependencies": { 3778 + "@supabase/node-fetch": "^2.6.14" 3779 + } 3780 + }, 3781 + "node_modules/@supabase/supabase-js": { 3782 + "version": "2.48.1", 3783 + "resolved": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.48.1.tgz", 3784 + "integrity": "sha512-VMD+CYk/KxfwGbI4fqwSUVA7CLr1izXpqfFerhnYPSi6LEKD8GoR4kuO5Cc8a+N43LnfSQwLJu4kVm2e4etEmA==", 3785 + "license": "MIT", 3786 + "dependencies": { 3787 + "@supabase/auth-js": "2.67.3", 3788 + "@supabase/functions-js": "2.4.4", 3789 + "@supabase/node-fetch": "2.6.15", 3790 + "@supabase/postgrest-js": "1.18.1", 3791 + "@supabase/realtime-js": "2.11.2", 3792 + "@supabase/storage-js": "2.7.1" 3793 + } 3794 + }, 3677 3795 "node_modules/@surma/rollup-plugin-off-main-thread": { 3678 3796 "version": "2.2.3", 3679 3797 "resolved": "https://registry.npmjs.org/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-2.2.3.tgz", ··· 4223 4341 "version": "4.0.2", 4224 4342 "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", 4225 4343 "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", 4344 + "license": "MIT" 4345 + }, 4346 + "node_modules/@types/phoenix": { 4347 + "version": "1.6.6", 4348 + "resolved": "https://registry.npmjs.org/@types/phoenix/-/phoenix-1.6.6.tgz", 4349 + "integrity": "sha512-PIzZZlEppgrpoT2QgbnDU+MMzuR6BbCjllj0bM70lWoejMeNJAxCchxnv7J3XFkI8MpygtRpzXrIlmWUBclP5A==", 4226 4350 "license": "MIT" 4227 4351 }, 4228 4352 "node_modules/@types/prettier": {
+1
package.json
··· 9 9 "@atproto/oauth-client-node": "^0.2.4", 10 10 "@fortawesome/free-solid-svg-icons": "^6.7.2", 11 11 "@fortawesome/react-fontawesome": "^0.2.2", 12 + "@supabase/supabase-js": "^2.48.1", 12 13 "@vercel/analytics": "^1.5.0", 13 14 "@vercel/edge": "^1.2.1", 14 15 "axios": "^1.7.9",
+39
src/components/UserProfile/UserProfile.js
··· 14 14 import ActivityCard from "./components/ActivityCard"; 15 15 import ScoreBreakdownCard from "./components/ScoreBreakdownCard"; 16 16 import ErrorPage from "../ErrorPage/ErrorPage"; 17 + import { supabase } from '../../lib/supabase'; 17 18 18 19 import "react-grid-layout/css/styles.css"; 19 20 import "react-resizable/css/styles.css"; 20 21 import "./UserProfile.css"; 22 + 23 + // Add this function to save user data to Supabase 24 + const saveUserData = async (userData) => { 25 + try { 26 + const { data, error } = await supabase 27 + .from('user_scores') 28 + .upsert({ 29 + handle: userData.handle, 30 + did: userData.did, 31 + display_name: userData.displayName, 32 + age_in_days: Math.floor(userData.ageInDays), 33 + combined_score: userData.combinedScore, 34 + bluesky_score: userData.blueskyScore, 35 + atproto_score: userData.atprotoScore, 36 + social_status: userData.socialStatus, 37 + posting_style: userData.postingStyle, 38 + profile_completeness: userData.profileCompleteness, 39 + alt_text_consistency: userData.altTextConsistencyBonus, 40 + engagement_score: userData.engagementScore, 41 + activity_score: userData.activityScore 42 + }, { 43 + onConflict: 'handle', 44 + returning: true 45 + }); 46 + 47 + if (error) throw error; 48 + return data; 49 + } catch (error) { 50 + console.error('Error saving user data:', error); 51 + return null; 52 + } 53 + }; 21 54 22 55 export const AccountDataContext = createContext(null); 23 56 ··· 209 242 210 243 setAccountData30Days(processAccountData(data.accountData30Days)); 211 244 setAccountData90Days(processAccountData(data.accountData90Days)); 245 + 246 + const processed30DaysData = processAccountData(data.accountData30Days); 247 + const processed90DaysData = processAccountData(data.accountData90Days); 248 + 249 + await saveUserData(processed90DaysData); 250 + 212 251 } catch (err) { 213 252 console.error("Error fetching account data:", err); 214 253 setError(err.message);