Skip to content

Commit 427b167

Browse files
author
Barthélémy Ledoux
authored
fix: remove copy button when not available (#19417)
1 parent 7b41115 commit 427b167

File tree

15 files changed

+74
-26
lines changed

15 files changed

+74
-26
lines changed

packages/app/src/runs/RunsEmpty.vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
<ol class="list-decimal ml-16px w-full text-gray-600">
1111
<li>
1212
<p class="mb-8px">
13-
<i18n-t keypath="runs.empty.step1">
13+
<i18n-t
14+
scope="global"
15+
keypath="runs.empty.step1"
16+
>
1417
<span class="text-indigo-500">{{ configFilePath }}</span>
1518
</i18n-t>
1619
</p>
@@ -23,7 +26,10 @@
2326
</li>
2427
<li class="mt-24px">
2528
<p class="mb-8px">
26-
<i18n-t keypath="runs.empty.step2">
29+
<i18n-t
30+
scope="global"
31+
keypath="runs.empty.step2"
32+
>
2733
<span class="text-indigo-400">{{ configFilePath }}</span>
2834
</i18n-t>
2935
</p>

packages/app/src/settings/project/Config.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
{{ t('settingsPage.config.title') }}
55
</template>
66
<template #description>
7-
<i18n-t keypath="settingsPage.config.description">
7+
<i18n-t
8+
scope="global"
9+
keypath="settingsPage.config.description"
10+
>
811
<OpenConfigFileInIDE :gql="props.gql" />
912
</i18n-t>
1013
</template>

packages/app/src/settings/project/ConfigLegend.vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
:class="CONFIG_LEGEND_COLOR_MAP.config"
1212
:label="legendText.config.label"
1313
>
14-
<i18n-t :keypath="legendText.config.descriptionKey">
14+
<i18n-t
15+
scope="global"
16+
:keypath="legendText.config.descriptionKey"
17+
>
1518
<OpenConfigFileInIDE :gql="props.gql" />
1619
</i18n-t>
1720
</ConfigBadge>
@@ -34,7 +37,10 @@
3437
:class="CONFIG_LEGEND_COLOR_MAP.plugin"
3538
:label="legendText.dynamic.label"
3639
>
37-
<i18n-t :keypath="legendText.dynamic.descriptionKey">
40+
<i18n-t
41+
scope="global"
42+
:keypath="legendText.dynamic.descriptionKey"
43+
>
3844
<ExternalLink
3945
href="https://on.cypress.io"
4046
class="text-purple-500"

packages/app/src/settings/project/Experiments.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
{{ t('settingsPage.experiments.title') }}
55
</template>
66
<template #description>
7-
<i18n-t keypath="settingsPage.experiments.description">
7+
<i18n-t
8+
scope="global"
9+
keypath="settingsPage.experiments.description"
10+
>
811
<ExternalLink
912
href="https://on.cypress.io/experiments"
1013
>

packages/app/src/settings/project/ProjectId.vue

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@
77
{{ t('settingsPage.projectId.title') }}
88
</template>
99
<template #description>
10-
<i18n-t keypath="settingsPage.projectId.description">
10+
<i18n-t
11+
scope="global"
12+
keypath="settingsPage.projectId.description"
13+
>
1114
<ExternalLink
1215
href="https://on.cypress.io/what-is-a-project-id"
1316
>
1417
{{ t('links.learnMore') }}
1518
</ExternalLink>
1619
</i18n-t>
1720
</template>
18-
<div class="flex items-center gap-10px">
21+
<div class="flex gap-10px items-center">
1922
<CodeBox
2023
:code="props.gql?.projectId || ''"
2124
:prefix-icon="IconOctothorpe"
@@ -39,6 +42,8 @@ import ExternalLink from '@cy/gql-components/ExternalLink.vue'
3942
import CodeBox from './CodeBox.vue'
4043
import type { ProjectIdFragment } from '../../generated/graphql'
4144
45+
const { t } = useI18n()
46+
4247
gql`
4348
fragment ProjectId on CurrentProject {
4449
id
@@ -50,5 +55,4 @@ const props = defineProps<{
5055
gql?: ProjectIdFragment | null
5156
}>()
5257
53-
const { t } = useI18n()
5458
</script>

packages/app/src/settings/project/RecordKey.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
{{ t('settingsPage.recordKey.title') }}
55
</template>
66
<template #description>
7-
<i18n-t keypath="settingsPage.recordKey.description">
7+
<i18n-t
8+
scope="global"
9+
keypath="settingsPage.recordKey.description"
10+
>
811
<ExternalLink
912
href="https://on.cypress.io/what-is-a-record-key"
1013
>

packages/app/src/settings/project/SpecPatterns.vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
{{ t('settingsPage.specPattern.title') }}
88
</template>
99
<template #description>
10-
<i18n-t keypath="settingsPage.specPattern.description">
10+
<i18n-t
11+
scope="global"
12+
keypath="settingsPage.specPattern.description"
13+
>
1114
<ExternalLink
1215
href="https://on.cypress.io"
1316
>
@@ -23,7 +26,10 @@
2326
<span class="font-medium text-gray-700">{{ t('settingsPage.specPattern.defaultIndicator') }}</span>
2427
</StatusIndicator>
2528
<span class="rounded bg-jade-100 py-4px px-8px text-jade-600 text-size-14px leading-16px">
26-
<i18n-t keypath="settingsPage.specPattern.matches">
29+
<i18n-t
30+
scope="global"
31+
keypath="settingsPage.specPattern.matches"
32+
>
2733
{{ matches }}
2834
</i18n-t>
2935
</span>

packages/app/src/specs/NoSpecsPage.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
data-testid="create-spec-page-description"
2424
class="leading-normal mb-32px text-gray-600 text-18px"
2525
>
26-
<i18n-t :keypath="descriptionKeyPath">
26+
<i18n-t
27+
scope="global"
28+
:keypath="descriptionKeyPath"
29+
>
2730
<button
2831
class="text-purple-500 hocus-link-default"
2932
>

packages/frontend-shared/src/components/CopyButton.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<Button
3+
v-if="isSupported"
34
:size="size"
45
:variant="variant"
56
@click="copyToClipboard"
@@ -9,7 +10,7 @@
910
#prefix
1011
>
1112
<i-cy-copy-clipboard_x16
12-
class="w-16px h-16px"
13+
class="h-16px w-16px"
1314
:class="{
1415
'icon-dark-indigo-500': variant === 'tertiary',
1516
'icon-dark-gray-500': variant === 'outline'
@@ -40,7 +41,7 @@ const props = withDefaults(defineProps<{
4041
size: 'md',
4142
})
4243
43-
const { copy, copied } = useClipboard({ copiedDuring: 2000 })
44+
const { copy, copied, isSupported } = useClipboard({ copiedDuring: 2000 })
4445
const copyToClipboard = () => {
4546
if (props.text) {
4647
copy(props.text)

packages/frontend-shared/src/components/ShikiHighlight.vue

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ shikiWrapperClasses computed property.
1818
-->
1919

2020
<template>
21-
<div class="relative text-left cursor-text">
21+
<div class="cursor-text text-left relative">
2222
<div
2323
v-if="highlighterInitialized"
2424
ref="codeEl"
@@ -51,19 +51,19 @@ shikiWrapperClasses computed property.
5151

5252
props.class,
5353
]"
54-
@click="copyOnClick ? () => copyCode() : () => {}"
54+
@click="copyOnClick && isSupported ? () => copyCode() : () => {}"
5555
v-html="highlightedCode"
5656
/>
5757
<pre
5858
v-else
59-
class="overflow-scroll border rounded border-gray-100 text-14px leading-24px font-light py-8px"
59+
class="border rounded font-light border-gray-100 py-8px text-14px leading-24px overflow-scroll"
6060
:class="[props.class, lineNumbers ? 'pl-56px' : 'pl-8px' ]"
6161
>{{ code }}</pre>
6262
<CopyButton
6363
v-if="copyButton"
6464
variant="outline"
6565
tabindex="-1"
66-
class="absolute bottom-8px right-8px"
66+
class="right-8px bottom-8px absolute"
6767
:text="code"
6868
no-icon
6969
/>
@@ -146,7 +146,7 @@ const highlightedCode = computed(() => {
146146

147147
const codeEl: Ref<HTMLElement | null> = ref(null)
148148

149-
const { copy, copied } = useClipboard()
149+
const { copy, isSupported } = useClipboard()
150150

151151
const copyCode = () => {
152152
if (codeEl.value) {
@@ -171,12 +171,12 @@ avoid colliding with styles elsewhere in the document.
171171
$offset: 1.1em;
172172

173173
.inline:deep(.shiki) {
174-
@apply py-1 px-2 bg-gray-50 text-gray-500 inline-block;
174+
@apply bg-gray-50 py-1 px-2 text-gray-500 inline-block;
175175
}
176176

177177
.shiki-wrapper {
178178
&:deep(.shiki) {
179-
@apply min-w-max border-r-10px border-r-transparent;
179+
@apply border-r-transparent min-w-max border-r-10px;
180180
}
181181

182182
&.wrap:deep(.line) {
@@ -191,7 +191,7 @@ $offset: 1.1em;
191191

192192
// Keep bg-gray-50 synced with the box-shadows.
193193
.line::before, .line:first-child::before {
194-
@apply bg-gray-50 text-gray-500 min-w-40px inline-block text-right px-8px mr-16px sticky;
194+
@apply bg-gray-50 text-right mr-16px min-w-40px px-8px text-gray-500 inline-block sticky;
195195
left: 0px !important;
196196
content: counter(step);
197197
counter-increment: step;

packages/frontend-shared/src/gql-components/topnav/LoginModal.vue

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<DialogDescription class="p-24px text-gray-700 font-normal">
2525
<i18n-t
2626
v-if="!viewer"
27+
scope="global"
2728
keypath="topNav.login.bodyInitial"
2829
>
2930
<ExternalLink
@@ -34,6 +35,7 @@
3435
</i18n-t>
3536
<i18n-t
3637
v-else-if="viewer"
38+
scope="global"
3739
keypath="topNav.login.bodySuccess"
3840
>
3941
<ExternalLink

packages/frontend-shared/src/gql-components/topnav/UpdateCypressModal.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@
99
<div class="p-24px text-gray-700">
1010
<p class="mb-16px">
1111
<i18n-t
12+
scope="global"
1213
keypath="topNav.updateCypress.currentlyRunning"
1314
>
1415
{{ installedVersion }}
1516
</i18n-t>
16-
<i18n-t :keypath="props.projectName ? 'topNav.updateCypress.pasteToUpgradeProject' : 'topNav.updateCypress.pasteToUpgradeGlobal'">
17+
<i18n-t
18+
scope="global"
19+
:keypath="props.projectName ? 'topNav.updateCypress.pasteToUpgradeProject' : 'topNav.updateCypress.pasteToUpgradeGlobal'"
20+
>
1721
<span class="font-bold">{{ t('topNav.updateCypress.rememberToCloseInsert') }}</span>
1822
</i18n-t>
1923
</p>

packages/launchpad/src/components/code/FileRow.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
>
3535
<p class="flex-grow ml-1 text-left">
3636
<span class="font-semibold">{{ t('setupPage.configFile.changesRequiredLabel') }}: </span>
37-
<i18n-t keypath="setupPage.configFile.changesRequiredDescription">
37+
<i18n-t
38+
scope="global"
39+
keypath="setupPage.configFile.changesRequiredDescription"
40+
>
3841
<span class="inline-block px-1 rounded bg-warning-200 text-warning-600">{{ filePath }}</span>
3942
</i18n-t>
4043
</p>

packages/launchpad/src/error/BaseError.vue

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
</p>
2222
<i18n-t
2323
v-else
24+
scope="global"
2425
keypath="launchpadErrors.generic.message"
2526
tag="p"
2627
class="font-light"

packages/launchpad/src/global/FileDropzone.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
class="mx-auto -mb-4px w-80px h-80px icon-dark-indigo-500 icon-light-indigo-200"
1919
/>
2020
<span class="font-light text-body-gray-700 text-18px">
21-
<i18n-t keypath="globalPage.empty.dropText">
21+
<i18n-t
22+
scope="global"
23+
keypath="globalPage.empty.dropText"
24+
>
2225
<button class="font-medium text-indigo-500 hocus-link-default">
2326
<!--
2427
This button allows keyboard users to fire a click event with the Enter or Space keys,

0 commit comments

Comments
 (0)