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

Fix indentation in Home Page #803

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 43 additions & 43 deletions resources/js/Pages/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,58 +99,58 @@
</template>

<script setup lang="ts">
import { Head as InertiaHead, usePage } from '@inertiajs/inertia-vue3';
import { useStore } from '../store';
import { CdxDialog, CdxButton, CdxIcon, CdxMessage } from "@wikimedia/codex";
import { cdxIconDie, cdxIconInfo } from '@wikimedia/codex-icons';
import ItemIdSearchTextarea from '../Components/ItemIdSearchTextarea.vue';
import { ref, computed } from 'vue';
import type { Ref } from 'vue';
import { Inertia } from '@inertiajs/inertia';

interface ErrorMessages {
[ key : string ] : string
}
import { Head as InertiaHead, usePage } from '@inertiajs/inertia-vue3';
import { useStore } from '../store';
import { CdxDialog, CdxButton, CdxIcon, CdxMessage } from "@wikimedia/codex";
import { cdxIconDie, cdxIconInfo } from '@wikimedia/codex-icons';
import ItemIdSearchTextarea from '../Components/ItemIdSearchTextarea.vue';
import { ref, computed } from 'vue';
import type { Ref } from 'vue';
import { Inertia } from '@inertiajs/inertia';

interface ErrorMessages {
[ key : string ] : string
}

interface FlashMessages {
errors : { [ key : string ] : string }
}
interface FlashMessages {
errors : { [ key : string ] : string }
}

const textarea = ref<InstanceType<typeof ItemIdSearchTextarea> | null>(null);
const store = useStore();
const page = usePage();
const textareaInputValue: Ref<string> = ref(store.lastSearchedIds);
const textarea = ref<InstanceType<typeof ItemIdSearchTextarea> | null>(null);
const store = useStore();
const page = usePage();
const textareaInputValue: Ref<string> = ref(store.lastSearchedIds);
const faqDialog = ref(false);

const faqDialog = ref(false);
const serversideValidationError = computed<boolean>(() => {
Copy link
Contributor Author

@guergana guergana Dec 27, 2023

Choose a reason for hiding this comment

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

The most notable issue was here, this computed property should have been indented to the left when the refactor was done.

const errors = page.props.value.errors as ErrorMessages;
return errors && Object.keys(errors).length > 0;
});
const serversideValidationError = computed<boolean>(() => {
const errors = page.props.value.errors as ErrorMessages;
return errors && Object.keys(errors).length > 0;
});

const unexpectedError = computed<string>(() => {
const flashMessages = page.props.value.flash as FlashMessages;
return (flashMessages.errors && flashMessages.errors.unexpected);
});
const unexpectedError = computed<string>(() => {
const flashMessages = page.props.value.flash as FlashMessages;
return (flashMessages.errors && flashMessages.errors.unexpected);
});

const loading = computed<boolean>(() => {
return (store.loading);
});
const loading = computed<boolean>(() => {
return (store.loading);
});

function send(): void{
(textarea as InstanceType<typeof ItemIdSearchTextarea>).value.validate();
function send(): void{
(textarea as InstanceType<typeof ItemIdSearchTextarea>).value.validate();

if((textarea as InstanceType<typeof ItemIdSearchTextarea>).value.validationError) {
return;
}
store.saveSearchedIds( textareaInputValue.value );
Inertia.get( '/results',
{ ids: (textarea as InstanceType<typeof ItemIdSearchTextarea>).value.serializeInput() }
);
if((textarea as InstanceType<typeof ItemIdSearchTextarea>).value.validationError) {
return;
}
store.saveSearchedIds( textareaInputValue.value );
Inertia.get( '/results',
{ ids: (textarea as InstanceType<typeof ItemIdSearchTextarea>).value.serializeInput() }
);
}

function showRandom(): void{
Inertia.get( '/random' );
}
function showRandom(): void{
Inertia.get( '/random' );
}
</script>

<style lang="scss">
Expand Down