-
-
Notifications
You must be signed in to change notification settings - Fork 146
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
chore: removed all code relating to communites and events #1056
chore: removed all code relating to communites and events #1056
Conversation
@JohnAllenTech is attempting to deploy a commit to the Codú Team on Vercel. A member of the Team first needs to authorize it. |
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (2)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughThis pull request entails the comprehensive removal of code and components related to the "Events & Communities" section from the application. Key changes include the deletion of various React components, schema definitions, and database tables associated with events and community functionalities. The Changes
Assessment against linked issues
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (5)
server/api/router/index.ts (1)
5-6
: LGTM! Consider removing the empty line.The changes in the imports section are consistent with the PR objectives. The removal of
communityRouter
andeventRouter
imports and the addition ofnotificationRouter
are appropriate.Consider removing the empty line 5 for better code organization:
import { commentRouter } from "./comment"; - import { notificationRouter } from "./notification";
app/(app)/[username]/_usernameClient.tsx (2)
79-86
: LGTM: Simplified tabs arrayThe removal of the
GROUPS
constant and the simplification of thetabs
array to only include the "Articles" tab is consistent with the PR objective of removing community-related code.Consider simplifying the
tabs
array declaration further:- const [ARTICLES] = ["articles"]; const tabs = [ { name: `Articles (${posts.length})`, - value: ARTICLES, - href: `?tab=${ARTICLES}`, - current: selectedTab === ARTICLES, + value: "articles", + href: "?tab=articles", + current: selectedTab === "articles", }, ];This change removes the need for the
ARTICLES
constant and simplifies the code.
Line range hint
160-176
: Suggestion: Further simplify the component structureWith the removal of the "Groups" tab, the current switch statement and
selectedTab
variable have become redundant. Consider simplifying the component structure to directly render the articles without the switch statement.Here's a suggested refactoring:
- {(() => { - switch (selectedTab) { - case ARTICLES: - return ( - <div> - {posts.length ? ( - posts.map( - ({ - slug, - title, - excerpt, - readTimeMins, - published, - id, - }) => { - if (!published) return; + <div> + {posts.length ? ( + posts.map( + ({ + slug, + title, + excerpt, + readTimeMins, + published, + id, + }) => { + if (!published) return null; + return ( + <ArticlePreview + key={slug} + slug={slug} + title={title} + excerpt={excerpt} + name={name} + username={username || ""} + image={image} + date={published} + readTime={readTimeMins} + menuOptions={ + isOwner + ? [ + { + label: "Edit", + href: `/create/${id}`, + postId: id, + }, + ] + : undefined + } + showBookmark={!isOwner} + id={id} + /> + ); + }, + ) + ) : ( + <p className="py-4 font-medium"> + Nothing published yet... 🥲 + </p> + )} + </div> - return ( - <ArticlePreview - key={slug} - slug={slug} - title={title} - excerpt={excerpt} - name={name} - username={username || ""} - image={image} - date={published} - readTime={readTimeMins} - menuOptions={ - isOwner - ? [ - { - label: "Edit", - href: `/create/${id}`, - postId: id, - }, - ] - : undefined - } - showBookmark={!isOwner} - id={id} - /> - ); - }, - ) - ) : ( - <p className="py-4 font-medium"> - Nothing published yet... 🥲 - </p> - )} - </div> - ); - case GROUPS: - return ( - <p className="py-4 font-medium">Groups are coming soon!</p> - ); - default: - return null; - } - })()}This change simplifies the component structure and removes the now-unnecessary switch statement and
selectedTab
logic.drizzle/seed.ts (2)
Line range hint
280-307
: Remove remaining community-related codeThe
generateCommunityData
function andcommunityData
variable are still present but unused. To fully align with the PR objective of removing all code related to communities and events, these should be removed.Apply this diff to remove the remaining community-related code:
- const generateCommunityData = (count: number) => { - return Array(count) - .fill(null) - .map(() => { - const country = chance.country(); - const countryFullName = countriesMap.get(country) || "Wakanda"; - const name = `${countryFullName} ${programmingLanguagesAndFrameWorks[chance.integer({ min: 0, max: programmingLanguagesAndFrameWorks.length - 1 })]} Users Group`; - const slug = `${name - .toLowerCase() - .replace(/ /g, "-") - .replace(/[^\w-]+/g, "")}-${nanoid(8)}`; - return { - id: nanoid(8), - name: name, - city: chance.city(), - country: countryFullName, - coverImage: `https://cdn.jsdelivr.net/npm/[email protected]/dist/images/${country}.svg`, - description: chance.sentence({ - words: chance.integer({ min: 200, max: 1000 }), - }), - excerpt: chance.sentence({ - words: chance.integer({ min: 10, max: 20 }), - }), - slug, - }; - }); - }; - const communityData = generateCommunityData(30);Also applies to: 309-309
Line range hint
385-412
: Consider updatingdeleteDataFromAllTables
functionThe
deleteDataFromAllTables
function currently attempts to delete all tables in the database. While this won't cause errors for removed tables, it might be more efficient to update the function to only target the tables that are still in use after the removal of event and community-related functionality.This is a minor optimization and not strictly necessary, but it could slightly improve the performance and clarity of the seeding process.
If you decide to implement this change, you could modify the SQL query to exclude the removed tables, for example:
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_type = 'BASE TABLE' AND table_name NOT IN ('community', 'membership', 'event', 'r_s_v_p');
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (26)
- app/(app)/[username]/_usernameClient.tsx (1 hunks)
- app/(app)/[username]/page.tsx (0 hunks)
- app/(app)/hub/[community]/_CommunityPage.tsx (0 hunks)
- app/(app)/hub/[community]/edit/page.tsx (0 hunks)
- app/(app)/hub/[community]/events/[event]/_EventPage.tsx (0 hunks)
- app/(app)/hub/[community]/events/[event]/edit/page.tsx (0 hunks)
- app/(app)/hub/[community]/events/[event]/page.tsx (0 hunks)
- app/(app)/hub/[community]/events/create/page.tsx (0 hunks)
- app/(app)/hub/[community]/page.tsx (0 hunks)
- app/(app)/hub/create/page.tsx (0 hunks)
- app/(app)/hub/layout.tsx (0 hunks)
- app/(app)/hub/page.tsx (0 hunks)
- components/CommunityForm/CommunityForm.tsx (0 hunks)
- components/CommunityPreview/CommunityPreview.tsx (0 hunks)
- components/EventForm/EventForm.tsx (0 hunks)
- components/EventPreview/EventPreview.tsx (0 hunks)
- config/site_settings.ts (1 hunks)
- containers/communities.tsx (0 hunks)
- containers/events.tsx (0 hunks)
- drizzle/seed.ts (1 hunks)
- schema/community.ts (0 hunks)
- schema/event.ts (0 hunks)
- server/api/router/community.ts (0 hunks)
- server/api/router/event.ts (0 hunks)
- server/api/router/index.ts (1 hunks)
- server/db/schema.ts (0 hunks)
💤 Files with no reviewable changes (22)
- app/(app)/[username]/page.tsx
- app/(app)/hub/[community]/_CommunityPage.tsx
- app/(app)/hub/[community]/edit/page.tsx
- app/(app)/hub/[community]/events/[event]/_EventPage.tsx
- app/(app)/hub/[community]/events/[event]/edit/page.tsx
- app/(app)/hub/[community]/events/[event]/page.tsx
- app/(app)/hub/[community]/events/create/page.tsx
- app/(app)/hub/[community]/page.tsx
- app/(app)/hub/create/page.tsx
- app/(app)/hub/layout.tsx
- app/(app)/hub/page.tsx
- components/CommunityForm/CommunityForm.tsx
- components/CommunityPreview/CommunityPreview.tsx
- components/EventForm/EventForm.tsx
- components/EventPreview/EventPreview.tsx
- containers/communities.tsx
- containers/events.tsx
- schema/community.ts
- schema/event.ts
- server/api/router/community.ts
- server/api/router/event.ts
- server/db/schema.ts
🔇 Additional comments (9)
server/api/router/index.ts (2)
Line range hint
11-19
: LGTM! Router definition changes are consistent with PR objectives.The modifications to the
appRouter
definition accurately reflect the removal of communities and events-related code, as well as the addition of the notification router. These changes align well with the PR objectives.
Line range hint
1-24
: LGTM! Overall structure is consistent. Verify removal across the codebase.The changes in this file are consistent with the PR objectives, and the overall structure remains intact. The removal of communities and events-related code appears to be complete within this file.
To ensure the complete removal of communities and events-related code across the codebase, please run the following verification script:
✅ Verification successful
✅ Verification Successful: No remaining community or event references found.
The verification scripts did not identify any lingering references to community or event routers, imports, or types within the codebase. This confirms that the removal of communities and events-related code is complete.
- Verified removal across all relevant files.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the removal of communities and events-related code # Test 1: Search for any remaining references to community or event routers echo "Searching for community or event router references:" rg --type typescript "community(R|r)outer|event(R|r)outer" # Test 2: Search for any remaining imports of community or event modules echo "Searching for community or event module imports:" rg --type typescript "from ['\"]\.+/community['\"]|from ['\"]\.+/event['\"]" # Test 3: Search for any remaining uses of community or event types echo "Searching for community or event type usage:" rg --type typescript "Community|Event" # Note: If any of these searches return results, it may indicate that some code related to communities and events still exists in the codebase.Length of output: 612
Script:
#!/bin/bash # Description: Re-verify the removal of communities and events-related code with corrected file types # Test 1: Search for any remaining references to community or event routers echo "Searching for community or event router references in .ts and .tsx files:" rg --type=ts "community(R|r)outer|event(R|r)outer" # Test 2: Search for any remaining imports of community or event modules echo "Searching for community or event module imports in .ts and .tsx files:" rg --type=ts "from ['\"]\.+/community['\"]|from ['\"]\.+/event['\"]" # Test 3: Search for any remaining uses of community or event types echo "Searching for community or event type usage in .ts and .tsx files:" rg --type=ts "Community|Event" # Note: If any of these searches return results, it may indicate that some code related to communities and events still exists in the codebase.Length of output: 6348
config/site_settings.ts (2)
4-4
:⚠️ Potential issueInconsistency with PR objectives and formatting issue
This change appears to be inconsistent with the PR objectives, which state that all code relating to communities and events should be removed. Instead of removing the "Events" entry, it has been modified to point to an external URL. Additionally, there's a formatting issue in the href value - it starts with "/https://", which is incorrect.
If the intention is to keep the Events link but point it to an external source, please update the PR description to reflect this change in approach. Otherwise, consider removing this entry entirely to align with the original PR objectives.
If you decide to keep the external link, please correct the formatting:
- { name: "Events", href: "/https://www.meetup.com/codu-community/" }, + { name: "Events", href: "https://www.meetup.com/codu-community/" },To ensure consistency across the codebase, let's check for any other references to the "/hub" route:
#!/bin/bash # Search for any remaining references to the "/hub" route rg '/hub'
Line range hint
1-28
: Overall inconsistency with PR objectivesThe changes in this file do not align with the stated PR objectives of removing all code relating to communities and events. Instead of removing the events-related entries, they have been modified to point to an external URL. This approach contradicts the goal outlined in issue #1014, which emphasizes removing unused code to streamline the codebase.
Please review the PR objectives and make one of the following decisions:
- Remove all events-related entries from this file to align with the original objectives.
- Update the PR description and linked issue to reflect the new approach of redirecting events to an external platform.
Additionally, ensure that all other files affected by this PR are consistent with the chosen approach. If the decision is to keep the external links, make sure to remove any unused components, routes, or backend code related to the previous events implementation.
Consider the following architectural implications:
- If removing all events-related code, ensure that no other parts of the application depend on or reference the removed functionality.
- If keeping the external links, evaluate whether this change affects the user experience or requires additional updates to the application's documentation or user interface.
To get a broader view of the changes across the codebase, let's run the following command:
#!/bin/bash # List all changed files in this PR gh pr view 1056 --json files --jq '.files[].path'This will help us verify if all necessary files have been updated or removed in accordance with the chosen approach.
app/(app)/[username]/_usernameClient.tsx (2)
Line range hint
1-265
: Overall assessment: Changes align with PR objectivesThe modifications in this file successfully remove code related to communities and events, aligning with the PR objectives. The
Profile
component has been simplified by removing thememberships
property, the "Groups" tab, and related functionality.A few suggestions for further optimization have been provided:
- Simplifying the
tabs
array declaration- Refactoring the component structure to remove the now-redundant switch statement
These changes will further streamline the code and improve maintainability.
Line range hint
15-30
: LGTM: Simplified profile type definitionThe removal of the
memberships
property from theprofile
type aligns with the PR objective of removing code related to communities and events. This change simplifies the type definition and focuses on the user's posts.To ensure all community-related code has been removed, let's run the following script:
drizzle/seed.ts (3)
3-3
: LGTM: Import statement updated correctlyThe import statement has been properly updated to remove references to
community
,membership
,event
, andr_s_v_p
. This change aligns with the PR objective of removing all code related to communities and events.
Line range hint
379-380
: LGTM: Event-related functions removedThe functions
generateEventData
andaddEventData
have been completely removed, and theaddSeedDataToDb
function no longer callsaddEventData
. These changes are consistent with the PR objective of removing all code related to communities and events.
Line range hint
1-424
: Overall changes align with PR objectivesThe modifications to
drizzle/seed.ts
largely achieve the goal of removing all code related to communities and events. The main changes include:
- Updating the import statement to remove event and community-related entities.
- Removing functions that generated and added event data.
- Simplifying the seeding process to focus on users, posts, tags, and likes.
These changes align well with the PR objectives. The only remaining task is to remove the unused
generateCommunityData
function andcommunityData
variable, as noted in a previous comment.After addressing that minor issue, this file will fully comply with the objective of removing all code relating to communities and events.
{ name: "Sponsorship", href: "/sponsorship" }, | ||
{ name: "Code Of Conduct", href: "/code-of-conduct" }, | ||
]; | ||
|
||
export const navigation = [ | ||
{ name: "Articles", href: "/articles" }, | ||
{ name: "Events", href: "/hub" }, | ||
{ name: "Events", href: "https://www.meetup.com/codu-community/" }, |
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.
💡 Codebase verification
Incomplete Removal of Events-Related Code
Multiple references to "Events" still exist in the codebase, which is inconsistent with the PR objective of removing all events-related code. Please ensure that all event-related entries are either removed or appropriately handled to align with the original PR objectives.
- Affected Files:
server/auth.ts
config/site_settings.ts
server/common/getPresignedUrl.ts
cdk/lib/storage-stack.ts
cdk/lib/cron-stack.ts
app/(app)/sponsorship/page.tsx
app/(app)/alpha/sponsorship/page.tsx
app/(app)/create/[[...paramsArr]]/_client.tsx
- (and others as listed in the shell script output)
🔗 Analysis chain
Inconsistency with PR objectives
Similar to the previous comment, this change is inconsistent with the stated PR objectives of removing all code relating to communities and events. The "Events" entry in the navigation
array has been modified to point to an external URL instead of being removed.
Please clarify if the intention has changed from removing all events-related code to redirecting events to an external platform. If so, update the PR description and linked issue to reflect this new approach. Otherwise, consider removing this entry entirely to align with the original PR objectives.
If the decision is to remove all events-related code as per the original objectives, apply this change:
- { name: "Events", href: "https://www.meetup.com/codu-community/" },
Let's check if there are any other references to events in the codebase that should be removed:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining references to "Events" in the codebase
rg -i '\bevents?\b' --type ts --type tsx --type js --type jsx
Length of output: 1046
Script:
#!/bin/bash
# Search for any remaining references to "Events" in the codebase
rg -i '\bevents?\b' --type ts --type tsx --type js --type jsx
Length of output: 91
Script:
#!/bin/bash
# Search for any remaining references to "Events" in the codebase
rg -i '\bevents?\b' -g '*.ts' -g '*.tsx' -g '*.js' -g '*.jsx'
Length of output: 7728
Script:
#!/bin/bash
# Search for any remaining references to "Events" in the codebase
rg -i '\bevents?\b' -g "*.ts" -g "*.tsx" -g "*.js" -g "*.jsx"
Length of output: 7728
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.
🌮 This was a long one to review! But great work.
Just a prettier push needed! |
Done! |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✨ Codu Pull Request 💻
Closes #1014
Pull Request details
Any Breaking changes
Associated Screenshots