Skip to content

Commit

Permalink
fix: disable IO redirecting button when no session
Browse files Browse the repository at this point in the history
  • Loading branch information
typed-sigterm committed Dec 22, 2024
1 parent 734857a commit c9d18b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { EventMessage, TaskAttributes } from '../shared/events';
import type { RunnerState } from './components/Runner.vue';
import type { RunnerState } from './utils';
import { onMounted, provide, readonly, ref } from 'vue';
import { EventMarker } from '../shared/events';
import Runner from './components/Runner.vue';
Expand Down Expand Up @@ -113,4 +113,9 @@ onMounted(() => {
a {
cursor: pointer;
}
a[aria-disabled="true"] {
opacity: 0.4;
cursor: not-allowed;
}
</style>
5 changes: 4 additions & 1 deletion src/components/IOPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { IconLoadingLoop } from '@iconify-prerendered/vue-line-md';
import { computed, inject, ref } from 'vue';
import { selectFile, ThemeInjectKey, useFontSize } from '../utils';
defineProps<{
const { disabled } = defineProps<{
title: string
readonly?: boolean
disabled?: boolean
Expand All @@ -19,6 +19,8 @@ const fontSize = useFontSize();
const isLinked = computed(() => typeof value.value === 'object');
const isLinking = ref(false);
async function linkFile() {
if (disabled)
return;
if (isLinked.value) { // unlink
value.value = '';
} else { // link
Expand All @@ -40,6 +42,7 @@ async function linkFile() {
class="link-file"
:title="isLinked ? 'Unlink the file' : 'Link a file'"
:aria-selected="isLinked"
:aria-disabled="disabled"
@click="linkFile"
>
<IconLoadingLoop v-if="isLinking" />
Expand Down

0 comments on commit c9d18b3

Please sign in to comment.