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

update link #2465

Merged
merged 1 commit into from
Dec 12, 2024
Merged

update link #2465

merged 1 commit into from
Dec 12, 2024

Conversation

aymericdelab
Copy link
Collaborator

@aymericdelab aymericdelab commented Dec 12, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new environment variable VITE_SOCIAL_LINK for dynamic URL configuration in the application.
    • Updated components to utilize the new VITE_SOCIAL_LINK for social sharing links, enhancing configurability.
  • Bug Fixes

    • Replaced hardcoded URLs with the new environment variable in multiple components, improving maintainability.

Copy link

vercel bot commented Dec 12, 2024

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

Name Status Preview Comments Updated (UTC)
eternum ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 9:44pm
eternum-docs 🔄 Building (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 9:44pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
eternum-landing ⬜️ Ignored (Inspect) Dec 12, 2024 9:44pm

Copy link
Contributor

coderabbitai bot commented Dec 12, 2024

Walkthrough

The pull request introduces a new environment variable, VITE_SOCIAL_LINK, with the value http://bit.ly/3Zz1mpp, into two environment files: client/.env.preview and client/.env.production. Additionally, the variable is integrated into the environment schema in client/env.ts. Modifications in several components, including PillageHistory.tsx, GuildMembers.tsx, and BattleTwitterShareButton.tsx, replace hardcoded URLs with the new environment variable for generating social sharing links.

Changes

File Path Change Summary
client/.env.preview Added variable: VITE_SOCIAL_LINK=http://bit.ly/3Zz1mpp
client/.env.production Added variable: VITE_SOCIAL_LINK=http://bit.ly/3Zz1mpp
client/env.ts Added variable: VITE_SOCIAL_LINK: z.string().url() in envSchema
client/src/ui/components/military/PillageHistory.tsx Added import for env and replaced hardcoded URL with env.VITE_SOCIAL_LINK in twitterText logic
client/src/ui/components/worldmap/guilds/GuildMembers.tsx Added import for env and replaced hardcoded URL with env.VITE_SOCIAL_LINK in formatSocialText
client/src/ui/modules/military/battle-view/battle-twitter-share-button.tsx Added import for env and replaced hardcoded URL with env.VITE_SOCIAL_LINK in generateTwitterText

Possibly related PRs

  • feat: Add twitter call to action button in pillage history #2142: The changes in this PR involve modifications to the PillageHistory.tsx component, which now uses the VITE_SOCIAL_LINK environment variable for constructing social sharing text, directly related to the addition of VITE_SOCIAL_LINK in the main PR.
  • improve socials #2340: This PR also modifies the GuildMembers.tsx component to utilize the VITE_SOCIAL_LINK environment variable for social media sharing, linking it to the changes made in the main PR.
  • test update env production #2419: Although this PR focuses on renaming an existing environment variable in client/.env.production, it is related as it deals with environment variable management, similar to the main PR's addition of VITE_SOCIAL_LINK.

Suggested reviewers

  • bob0005

🐇 In the code we hop and play,
New links to share, hip-hip-hooray!
With VITE_SOCIAL_LINK in sight,
Our sharing's now a pure delight!
So gather 'round, let's spread the cheer,
With every click, our friends draw near! 🌟


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

mentatbot bot commented Dec 12, 2024

You are out of MentatBot reviews. Your usage will refresh December 16 at 08:00 AM.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
client/src/ui/modules/military/battle-view/battle-twitter-share-button.tsx (1)

11-11: Consider simplifying the import path.

The relative import path with multiple levels (../../../../../env) is hard to maintain. Consider using an absolute import path instead.

-import { env } from "../../../../../env";
+import { env } from "@/env";
client/src/ui/components/military/PillageHistory.tsx (1)

11-11: Consider simplifying the import path.

The relative import path with multiple levels (../../../../env) is hard to maintain. Consider using an absolute import path instead.

-import { env } from "../../../../env";
+import { env } from "@/env";
client/src/ui/components/worldmap/guilds/GuildMembers.tsx (1)

9-9: Consider using path alias instead of relative path

The import statement uses multiple parent directory traversals. Consider using a path alias (like existing @/ imports) to improve maintainability.

-import { env } from "../../../../../env";
+import { env } from "@/env";
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 09b444e and 6b4a719.

📒 Files selected for processing (6)
  • client/.env.preview (1 hunks)
  • client/.env.production (1 hunks)
  • client/env.ts (1 hunks)
  • client/src/ui/components/military/PillageHistory.tsx (2 hunks)
  • client/src/ui/components/worldmap/guilds/GuildMembers.tsx (2 hunks)
  • client/src/ui/modules/military/battle-view/battle-twitter-share-button.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • client/.env.preview
  • client/.env.production
🔇 Additional comments (4)
client/env.ts (1)

46-48: LGTM! Environment variable schema looks good.

The new VITE_SOCIAL_LINK environment variable is properly defined with URL validation.

Let's verify the environment variable is properly set in the environment files:

✅ Verification successful

Environment variable is properly configured in preview and production environments

The VITE_SOCIAL_LINK environment variable is correctly set in both .env.preview and .env.production files with valid URL values. The configuration aligns with the schema definition.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if VITE_SOCIAL_LINK is properly set in environment files

# Test: Search for VITE_SOCIAL_LINK in environment files
echo "Checking environment files for VITE_SOCIAL_LINK:"
rg "VITE_SOCIAL_LINK" client/.env*

Length of output: 317

client/src/ui/modules/military/battle-view/battle-twitter-share-button.tsx (1)

86-86: LGTM! URL replacement looks good.

The hardcoded window.location.origin has been correctly replaced with the environment variable.

client/src/ui/components/military/PillageHistory.tsx (1)

46-46: LGTM! URL replacement looks good.

The hardcoded window.location.origin has been correctly replaced with the environment variable.

client/src/ui/components/worldmap/guilds/GuildMembers.tsx (1)

95-95: Verify environment variable setup and URL accessibility

The change from dynamic URL (window.location.origin) to static URL (env.VITE_SOCIAL_LINK) looks good, but please ensure:

  1. The URL is properly configured in all environment files
  2. The URL is accessible and redirects correctly
✅ Verification successful

Environment variable setup and URL redirection verified

The verification shows:

  • VITE_SOCIAL_LINK is properly defined in the schema with URL validation
  • The variable is consistently set in both preview and production environments
  • The URL (http://bit.ly/3Zz1mpp) is accessible and correctly redirects to eternum.realms.world
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify environment variable setup and URL accessibility

# Check if env variable is defined in schema
rg "VITE_SOCIAL_LINK" -A 3 "client/env.ts"

# Check if env variable is set in environment files
echo "Preview env:"
rg "VITE_SOCIAL_LINK" "client/.env.preview"
echo "Production env:"
rg "VITE_SOCIAL_LINK" "client/.env.production"

# Verify URL format and accessibility
curl -I "http://bit.ly/3Zz1mpp"

Length of output: 1130

@aymericdelab aymericdelab merged commit b84417e into next Dec 12, 2024
7 of 9 checks passed
@aymericdelab aymericdelab deleted the link branch December 12, 2024 21:45
Copy link

Failed to generate code suggestions for PR

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.

1 participant