-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: persist gallery draft #326
Merged
Merged
Changes from 50 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
7f59dc7
wip
shahin-hq beba28b
wip
shahin-hq 2b2b96a
wip
shahin-hq 694e033
wip
shahin-hq 1f92817
wip
shahin-hq 8cc7418
wip
shahin-hq b03b234
wip
shahin-hq 2d110aa
Merge branch 'develop' into feat/persist-gallery-drafts
shahin-hq 3bcd7fc
wip
shahin-hq bdc3a87
Merge remote-tracking branch 'origin/feat/persist-gallery-drafts' int…
shahin-hq 4a49115
wip
shahin-hq ea516a6
Merge branch 'develop' into feat/persist-gallery-drafts
shahin-hq b0aef6f
wip
shahin-hq 07cd85c
Merge remote-tracking branch 'origin/feat/persist-gallery-drafts' int…
shahin-hq 63bc5a9
wip
shahin-hq 6a0d962
Merge branch 'develop' into feat/persist-gallery-drafts
alfonsobries 48f6b47
Merge branch 'develop' into feat/persist-gallery-drafts
goga-m df01afd
wip
shahin-hq 69e3f55
wip
shahin-hq 08f07f4
Merge branch 'develop' into feat/persist-gallery-drafts
shahin-hq 26d5e80
Merge remote-tracking branch 'origin/feat/persist-gallery-drafts' int…
shahin-hq 228ea59
wip
shahin-hq 79f5d9b
wip
shahin-hq 19b5d54
wip
shahin-hq a6dce57
Merge branch 'feat/persist-gallery-drafts' into feat/save-gallery-drafts
shahin-hq 05ed6d4
wip
shahin-hq 0c373ce
wip
shahin-hq 72c8e27
Merge branch 'feat/persist-gallery-drafts' into feat/save-gallery-drafts
shahin-hq 11be9a8
wip
shahin-hq 6513069
wip
shahin-hq bce9e62
Optimize 1 SVG(s)
shahin-hq 1e12f9b
Optimize 1 SVG(s)
ItsANameToo 223a153
wip
shahin-hq e7e0778
Merge branch 'feat/gallery-drafts' into feat/persist-gallery-drafts
shahin-hq 00561a1
Merge branch 'feat/gallery-drafts' into feat/persist-gallery-drafts
shahin-hq 5975eee
Merge remote-tracking branch 'origin/feat/save-gallery-drafts' into f…
shahin-hq d013354
fix tests
shahin-hq cc12a80
fix tests
shahin-hq 55cf480
fix tests
shahin-hq a54a9f1
fix tests
shahin-hq 39491b1
fix tests
shahin-hq e89e4bb
fix tests
shahin-hq cc1c30c
fix tests
shahin-hq f4475eb
Merge branch 'feat/gallery-drafts' into feat/save-gallery-drafts
shahin-hq c66fb97
fix tests
shahin-hq 84e8755
Merge branch 'feat/persist-gallery-drafts' into feat/save-gallery-drafts
shahin-hq 02b39f4
fix tests
shahin-hq cde31a2
mip
shahin-hq 267323d
wip
shahin-hq cd569ac
Merge branch 'feat/gallery-drafts' into feat/save-gallery-drafts
shahin-hq cdda34b
feat: handle gallery drafts toolbar actions (#346)
shahin-hq 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
34 changes: 34 additions & 0 deletions
34
...rces/js/Components/Galleries/GalleryPage/GalleryActionToolbar/GalleryDraftStatus.test.tsx
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,34 @@ | ||
import { expect } from "vitest"; | ||
import { GalleryDraftStatus } from "@/Components/Galleries/GalleryPage/GalleryActionToolbar/GalleryDraftStatus"; | ||
import { render, screen } from "@/Tests/testing-library"; | ||
|
||
describe("GalleryDraftStatus", () => { | ||
it("should show draft saved status", () => { | ||
render( | ||
<GalleryDraftStatus | ||
draftId={1} | ||
isSavingDraft={false} | ||
/>, | ||
); | ||
|
||
expect(screen.getByText(/Draft Saved/)).toBeInTheDocument(); | ||
}); | ||
|
||
it("should show saving status", () => { | ||
render( | ||
<GalleryDraftStatus | ||
draftId={1} | ||
isSavingDraft={true} | ||
/>, | ||
); | ||
|
||
expect(screen.getByText(/Saving to draft/)).toBeInTheDocument(); | ||
}); | ||
|
||
it("should not render any status message", () => { | ||
render(<GalleryDraftStatus />); | ||
|
||
expect(screen.queryByText(/Saving to draft/)).not.toBeInTheDocument(); | ||
expect(screen.queryByText(/Draft Saved/)).not.toBeInTheDocument(); | ||
}); | ||
}); |
45 changes: 45 additions & 0 deletions
45
resources/js/Components/Galleries/GalleryPage/GalleryActionToolbar/GalleryDraftStatus.tsx
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,45 @@ | ||
import { useTranslation } from "react-i18next"; | ||
import { Icon } from "@/Components/Icon"; | ||
import { isTruthy } from "@/Utils/is-truthy"; | ||
|
||
export const GalleryDraftStatus = ({ | ||
draftId, | ||
isSavingDraft, | ||
}: { | ||
draftId?: number; | ||
isSavingDraft?: boolean; | ||
}): JSX.Element => { | ||
const { t } = useTranslation(); | ||
|
||
if (isTruthy(draftId) && isSavingDraft === false) { | ||
return ( | ||
<div className="flex items-center"> | ||
<Icon | ||
size="lg" | ||
name="FatDoubleCheck" | ||
className="text-theme-secondary-700" | ||
/> | ||
<div className="ml-2 hidden text-sm font-medium leading-5.5 text-theme-secondary-700 xs:block"> | ||
{t("pages.galleries.create.draft_saved")} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
if (isSavingDraft === true) { | ||
return ( | ||
<div className="flex items-center"> | ||
<Icon | ||
size="lg" | ||
name="Refresh" | ||
className="text-theme-secondary-700 dark:text-theme-dark-200" | ||
/> | ||
<div className="ml-2 hidden text-sm font-medium leading-5.5 text-theme-secondary-700 dark:text-theme-dark-200 xs:block"> | ||
{t("pages.galleries.create.saving_to_draft")} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
return <></>; | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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.
I didn't want to make this function
async
that is why usedthen