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: Modify the copyright #7670

Merged
merged 1 commit into from
Jan 8, 2025
Merged

feat: Modify the copyright #7670

merged 1 commit into from
Jan 8, 2025

Conversation

lan-yonghui
Copy link
Member

No description provided.

Copy link

f2c-ci-robot bot commented Jan 8, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@@ -25,6 +25,7 @@ const globalStore = GlobalStore();
const mobile = computed(() => {
return globalStore.isMobile();
});
const year = new Date().getFullYear();
</script>

<style scoped lang="scss">
Copy link
Member

Choose a reason for hiding this comment

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

The changes look mostly correct but there are a few minor improvements and optimizations:

  1. Variable Naming: It's good practice to use consistently named variables to improve readability. You can rename year to something meaningful.

  2. Date Formatting in Template: Use string formatting in templates directly for clarity and efficiency.

  3. Code Reusability: The logic for calculating the year can be extracted into a utility function if needed, keeping the component cleaner.

Here is an improved version of the code with these suggestions:

@@ -3,10 +3,10 @@
     <div class="flex w-full flex-col gap-4 md:justify-between md:flex-row">
         <div class="flex flex-wrap gap-4">
             <a v-if="!globalStore.isIntl" :href="externalLink('FIT2CLOUD')" target="_blank">
-                Copyright © 2014-{{ globalStore.year }} {{ $t('commons.fit2cloud') }}
+                Copyright © {{ getYear() }} {{ $t('commons.fit2cloud') }}
             </a>
             <a v-if="globalStore.isIntl" :href="externalLink('LINGXIA')" target="_blank">
-                Copyright © {{ globalStore.year }} {{ $t('commons.lingxia') }}
+                Copyright © {{ getYear() }} {{ $t('commons.lingxia') }}
             </a>
         </div>
         <div class="flex flex-row gap-2 md:flex-col lg:flex-row">

And in your script section:

<script>
import { globalStore } from "@stores/global";
const mobile = computed(() => {
    return globalStore.isMobile();
});
function getYear() {
    return new Date().getFullYear();
}
</script>

<style scoped lang="scss">
...
</style>

Explanation:

  • Extracted Year Function (getYear()): This function calculates the current year, which keeps the main template clean and makes the code more modular.
  • String Interpolation: Directly using ${new Date().getFullYear()} in the template simplifies handling dates.

Copy link

sonarqubecloud bot commented Jan 8, 2025

Copy link
Member

@wanghe-fit2cloud wanghe-fit2cloud left a comment

Choose a reason for hiding this comment

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

/lgtm

@wanghe-fit2cloud
Copy link
Member

/approve

Copy link

f2c-ci-robot bot commented Jan 8, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wanghe-fit2cloud

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved label Jan 8, 2025
@f2c-ci-robot f2c-ci-robot bot merged commit 87009dd into dev Jan 8, 2025
6 checks passed
@f2c-ci-robot f2c-ci-robot bot deleted the pr@dev@feat_copyright branch January 8, 2025 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants