Skip to content

Commit

Permalink
fix: Post Validation, on search, share timeline link and redirect lin…
Browse files Browse the repository at this point in the history
…k change (#1755)

* fix: set debio tips (#1753)

fix: set debio tips

* chore(deps): bump google-github-actions/release-please-action from 3.7.4 to 3.7.5 (#1754)

chore(deps): bump google-github-actions/release-please-action

Bumps [google-github-actions/release-please-action](https://github.com/google-github-actions/release-please-action) from 3.7.4 to 3.7.5.
- [Release notes](https://github.com/google-github-actions/release-please-action/releases)
- [Changelog](https://github.com/google-github-actions/release-please-action/blob/main/CHANGELOG.md)
- [Commits](google-github-actions/release-please-action@d3c71f9...e0b9d18)

---
updated-dependencies:
- dependency-name: google-github-actions/release-please-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: change share timeline link, redirect timeline, post validation create

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Kristian Ruben <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 10, 2023
1 parent 7713ca7 commit 8a3ed01
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
9 changes: 4 additions & 5 deletions src/components/Expericence/Experience.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,15 @@ export const Experience: React.FC<ExperienceProps> = props => {
const isOwnExperience = userExperience.experience.user.id === user?.id;
const experienceId = userExperience.experience.id;
const userExperienceId = userExperience.id;
const link = publicRuntimeConfig.appAuthURL + `/experience/${experienceId}`;
const link =
publicRuntimeConfig.appAuthURL + `/type=experience&id=${experienceId}`;
const { userExperiencesMeta } = useExperienceHook();
const totalOwnedExperience =
userExperiencesMeta.additionalData?.totalOwnedExperience ?? 0;
const handleClickExperience = () => {
handleCloseSettings();

if (selectable && onSelect) {
onSelect(experienceId);
}
console.log(selectable);
onSelect(experienceId);
};

const handleCloneExperience = () => {
Expand Down
19 changes: 7 additions & 12 deletions src/components/ExperienceList/ExperienceList.container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export const ExperienceListContainer: React.FC<ExperienceListContainerProps> =
enableClone,
enableSubscribe,
hasMore = false,
filterTimeline = false,
loadNextPage,
refreshExperience,
noButton,
Expand Down Expand Up @@ -87,17 +86,13 @@ export const ExperienceListContainer: React.FC<ExperienceListContainerProps> =
type: TimelineType,
userExperience: WrappedExperience,
) => {
if (filterTimeline) {
router.push(
`/?type=experience&id=${userExperience.experience.id}`,
undefined,
{
shallow: true,
},
);
} else {
router.push(`/topic/experience?id=${userExperience.experience.id}`);
}
router.push(
`/?type=experience&id=${userExperience.experience.id}`,
undefined,
{
shallow: true,
},
);
};

const handleRemoveExperience = (experienceId: string) => {
Expand Down
12 changes: 7 additions & 5 deletions src/components/PostCreate/PostCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const PostCreate: React.FC<PostCreateProps> = props => {

const [activeTab, setActiveTab] = useState<PostCreateType>('create');
const [post, setPost] = useState<Partial<Post>>(initialPost);
const [loading, setLoading] = useState<boolean>(false);
const [editorValue, setEditorValue] = useState<string>('');
const content = useRef('');

const [importUrl, setImport] = useState<string | undefined>();
Expand Down Expand Up @@ -250,12 +250,14 @@ export const PostCreate: React.FC<PostCreateProps> = props => {
setImport(undefined);
setShowExclusive(false);
setExclusiveContent(null);

setEditorValue('');
onClose();
};

const handleContentChange = (data, loading) => {
setLoading(loading);
const handleContentChange = data => {
if (data[0].children[0].text !== '') {
setEditorValue(data[0].children[0].text);
}
content.current = data;
};

Expand Down Expand Up @@ -431,7 +433,7 @@ export const PostCreate: React.FC<PostCreateProps> = props => {
<ShowIf condition={!showExclusive}>
<ShowIf condition={post.visibility !== 'selected_user'}>
<Button
disabled={loading}
disabled={editorValue === ''}
variant="contained"
color="primary"
size="small"
Expand Down
9 changes: 8 additions & 1 deletion src/components/common/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@ export const Editor: React.FC<EditorProps> = props => {
},
};
};
const handleChange = useCallback(
(value: EditorValue) => {
props.onChange(value, false);
},

[props.onChange],
);

return (
<div
Expand All @@ -294,6 +301,7 @@ export const Editor: React.FC<EditorProps> = props => {
autoFocus: autoFocus,
}}
plugins={plugins}
onChange={handleChange}
initialValue={initial}>
<MentionCombobox<MentionDetail>
onRenderItem={renderComboboxItem}
Expand All @@ -306,7 +314,6 @@ export const Editor: React.FC<EditorProps> = props => {
},
}}
/>

<Counter className={styles.limit} limit={MAX_CHARACTER_LIMIT} />
</Plate>
</div>
Expand Down

0 comments on commit 8a3ed01

Please sign in to comment.