-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
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"> |
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.
The changes look mostly correct but there are a few minor improvements and optimizations:
-
Variable Naming: It's good practice to use consistently named variables to improve readability. You can rename
year
to something meaningful. -
Date Formatting in Template: Use string formatting in templates directly for clarity and efficiency.
-
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.
Quality Gate passedIssues Measures |
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.
/lgtm
/approve |
[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 |
No description provided.