-
Notifications
You must be signed in to change notification settings - Fork 320
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
Form focused mode #640
Open
chiragchhatrala
wants to merge
15
commits into
main
Choose a base branch
from
147a6-form-focused-mode
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Form focused mode #640
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
dabef40
Form Focused mode - WIP
chiragchhatrala 72264ae
Implement focused form mode in OpenCompleteForm and add OpenFormFocus…
chiragchhatrala 440125a
Enhance OpenForm components for improved navigation and visual consis…
chiragchhatrala b1febab
Add FormatChangeModal component and integrate format change handling …
chiragchhatrala a791916
Enhance OpenFormFocused and FieldOptions components for improved user…
chiragchhatrala 62d86f3
Merge branch 'main' into 147a6-form-focused-mode
chiragchhatrala a1ad9fd
Update OpenFormFocused component and add internationalization support…
chiragchhatrala 61143fc
Refactor OpenFormFocused component to streamline field handling and i…
chiragchhatrala 9a19502
When form is focused mode make cover image screen
chiragchhatrala 459dcf7
Merge branch 'main' into 147a6-form-focused-mode
chiragchhatrala 0db1fc0
Add translations for 'Back' and 'Next' buttons in new languages
chiragchhatrala f24cab9
Enhance form components by adding 'creating' prop for improved state …
chiragchhatrala cd60d43
Update form components and dependencies
JhumanJ 1b93185
Merge branch 'main' into 147a6-form-focused-mode
JhumanJ 228df27
Merge branch '147a6-form-focused-mode' of https://github.com/JhumanJ/…
JhumanJ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
api/database/migrations/2024_12_04_163142_add_format_to_forms_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class () extends Migration { | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::table('forms', function (Blueprint $table) { | ||
$table->string('format')->default('regular'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::table('forms', function (Blueprint $table) { | ||
$table->dropColumn('format'); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<template> | ||
<modal | ||
:show="show && form.format === 'focused' && removeBlocks.length > 0" | ||
:compact-header="true" | ||
:closeable="false" | ||
@close="onCancel" | ||
> | ||
<template #icon> | ||
<Icon | ||
name="heroicons:document-text" | ||
class="w-10 h-10 text-blue" | ||
/> | ||
</template> | ||
<template #title> | ||
Format Change | ||
</template> | ||
|
||
<div class="p-4"> | ||
If you change the format, below block(s) will be removed from the form: | ||
<ul | ||
v-if="removeBlocks.length > 0" | ||
class="list-disc ml-4 mt-2" | ||
> | ||
<li | ||
v-for="block in removeBlocks" | ||
:key="block.id" | ||
> | ||
{{ block.name }} | ||
</li> | ||
</ul> | ||
|
||
<div class="flex justify-end mt-4 px-6"> | ||
<v-button | ||
class="mr-2" | ||
@click.prevent="changeFormat" | ||
> | ||
It's ok | ||
</v-button> | ||
<v-button | ||
color="white" | ||
@click.prevent="onCancel" | ||
> | ||
Cancel | ||
</v-button> | ||
</div> | ||
</div> | ||
</modal> | ||
</template> | ||
|
||
<script setup> | ||
const props = defineProps({ | ||
show: { | ||
type: Boolean, | ||
default: false, | ||
} | ||
}) | ||
|
||
const emit = defineEmits(['close']) | ||
const removeTypes = ['nf-page-break','nf-divider','nf-image','nf-code'] | ||
const formStore = useWorkingFormStore() | ||
const form = computed(() => formStore.content) | ||
|
||
const removeBlocks = computed(() => form.value.properties.filter(field => removeTypes.includes(field.type))) | ||
|
||
const changeFormat = () => { | ||
form.value.properties = form.value.properties.filter(property => !removeTypes.includes(property.type)) | ||
form.value.format = 'focused' | ||
emit('close') | ||
} | ||
|
||
const onCancel = () => { | ||
form.value.format = 'regular' | ||
emit('close') | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🛠️ Refactor suggestion
Move removeTypes to a constants file
The
removeTypes
array should be moved to a constants file for better maintainability and reusability.Create a new constant in a shared location: