Repository: kestra-io/kestra
File: ui/src/components/no-code/components/tasks/TaskString.vue (Vue)

Code before:
    import InputText from "../inputs/InputText.vue";
    import {Schema} from "./getTaskComponent";

    const props = defineProps<{
        disabled?: boolean;
        modelValue?: string;
        schema?: Schema;
        root?: string;
        task?: any;
    }>();

    const emit = defineEmits<{
        (e: "update:modelValue", value: string | undefined): void;
    }>();


    const pebble = ref(false);

    // Function to detect programming language from task type
    function detectLanguageFromTaskType(): string {
        return props.schema?.$language ?? "plaintext";
    }

    // Computed property for editor language
    const editorLanguage = computed(() => {
        return detectLanguageFromTaskType();
    });

    const values = computed(() => {
        if (props.modelValue === undefined) {
            return props.schema?.default;
        }

        return props.modelValue;
    })

    onMounted(() => {
        const schema = props.schema;
        if (!schema) return;

        if (!["duration", "date-time"].includes(schema.format ?? "") || !props.modelValue) {
            pebble.value = false;
        } else if (schema.format === "duration" && values.value) {
            pebble.value = !$moment.duration(props.modelValue).isValid();
        } else if (schema.format === "date-time" && values.value) {
            pebble.value = isNaN(Date.parse(props.modelValue as string));
        }
    });

    // FIXME: hardcoded condition only show days input for timeWindow durations
    const showDurationDays = computed(() => {

Review comment (refactor):
Can you simplify this by just returning the `return props.schema?.$language ?? "plaintext";` here and removing the method `detectLanguageFromTaskType`?

Code after:
    import InputText from "../inputs/InputText.vue";
    import {Schema} from "./getTaskComponent";

    const props = defineProps<{
        disabled?: boolean;
        modelValue?: string;
        schema?: Schema;
        root?: string;
        task?: any;
    }>();

    const emit = defineEmits<{
        (e: "update:modelValue", value: string | undefined): void;
    }>();


    const pebble = ref(false);

    // Computed property for editor language
    const editorLanguage = computed(() => {
        return props.schema?.$language ?? "plaintext";
    });

    const values = computed(() => {
        if (props.modelValue === undefined) {
            return props.schema?.default;
        }

        return props.modelValue;
    })

    onMounted(() => {
        const schema = props.schema;
        if (!schema) return;

        if (!["duration", "date-time"].includes(schema.format ?? "") || !props.modelValue) {
            pebble.value = false;
        } else if (schema.format === "duration" && values.value) {
            pebble.value = !$moment.duration(props.modelValue).isValid();
        } else if (schema.format === "date-time" && values.value) {
            pebble.value = isNaN(Date.parse(props.modelValue as string));
        }
    });

    // FIXME: hardcoded condition only show days input for timeWindow durations
    const showDurationDays = computed(() => {
        return props.schema?.format === "duration" && props.root?.startsWith("timeWindow")
    });

    const daysDurationValue = computed<number | undefined>(() => {
        if (typeof values.value === "string") {