Skip to content
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

feat: merge getff to getpref #4068

Merged
merged 1 commit into from Nov 26, 2023
Merged

feat: merge getff to getpref #4068

merged 1 commit into from Nov 26, 2023

Conversation

bigint
Copy link
Member

@bigint bigint commented Nov 26, 2023

What does this PR do?

🤖[deprecated] Generated by Copilot at 7e3381b

This pull request removes the FeatureFlagsProvider component and the /feature/getFeatureFlags endpoint, as they are no longer needed. It also improves the integration of feature flags, pro status, and other preferences between the API and the web app, and allows the staff to view and manage these settings for the users. Additionally, it formats some code for readability and consistency.

Related issues

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Enhancement (non-breaking small changes to existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Explanation of the changes

🤖[deprecated] Generated by Copilot at 7e3381b

  • Remove the FeatureFlagsProvider component and its usage as the feature flags are handled by the PreferencesProvider component (link, link, link)
  • Import the FeatureFlag enum and the useFeatureFlagsStore hook in the PreferencesProvider component to use them for setting and getting the feature flags from the local storage (link, link)
  • Define and call setter functions from the useFeatureFlagsStore hook in the PreferencesProvider component to update the feature flags, staff mode, and gardener mode based on the data received from the API (link, link)
  • Update the API endpoints for fetching the preferences after toggling the staff mode or the gardener mode from /feature/getFeatureFlags to /preference/getPreferences in the StaffMode.tsx and GardenerMode.tsx components, as the former endpoint is deprecated and the latter endpoint returns the updated feature flags along with other preferences (link, link)
  • Delete the /feature/getFeatureFlags API endpoint as it is no longer used (link)
  • Add a new query to fetch the preferences from the API using the profile id as a parameter in the ProfileStaffTool.tsx component, which returns the preference object that includes the pro status and the feature flags (link)
  • Pass the preferences, preferencesLoading, and isPro props to the Access and FeatureFlags components from the ProfileStaffTool component (link)
  • Add a new query to fetch the profile features from the database along with the preference and pro status in the /preference/getPreferences API endpoint, and add the features to the response object as an array of feature keys (link)
  • Format the headers object in a single line in the /internal/cloudflare/purge.ts API endpoint to improve readability and consistency (link)
  • Remove the imports and the state and query logic for fetching the feature flags from the API in the FeatureFlags component, as they are passed as props from the parent component (link, link)
  • Add a null check for the flags array and use the loading prop instead of the isLoading variable in the FeatureFlags component (link)
  • Add the useUpdateEffect hook and the isPro prop to the ActivateLifetimePro component to update the state when the prop changes (link, link)
  • Pass the isPro prop to the ActivateLifetimePro component from the Access component (link, link)

Emoji

📝🚀🔧

Copy link

vercel bot commented Nov 26, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
api ✅ Ready (Inspect) Visit Preview Nov 26, 2023 6:20am
prerender ✅ Ready (Inspect) Visit Preview Nov 26, 2023 6:20am
web ✅ Ready (Inspect) Visit Preview Nov 26, 2023 6:20am

Copy link

height bot commented Nov 26, 2023

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@bigint bigint merged commit 7dca94a into main Nov 26, 2023
4 of 9 checks passed
@bigint bigint deleted the merge-features-to-pref branch November 26, 2023 06:16
@vercel vercel bot temporarily deployed to Preview – prerender November 26, 2023 06:17 Inactive
@vercel vercel bot temporarily deployed to Preview – api November 26, 2023 06:17 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant