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

Make links out of search results and question titles when embedded #309

Merged
merged 2 commits into from
Sep 3, 2023

Conversation

Aprillion
Copy link
Collaborator

Improvements for #307 => testing on https://aisafety.preview.softr.app/new

  • can be controlled by showDetails url param
  • I was not able to reproduce dynamic height in Softr, either CSP or it doesn't allow listening to events somehow, so this is a version more friendly for static height

* can be controlled by showDetails url param
* I was not able to reproduce dynamic height in Softr, either CSP or it doesn't allow listening to events somehow, so this is a version more friendly for static height
mruwnik
mruwnik previously approved these changes Sep 3, 2023
@@ -194,6 +196,12 @@ export default function useQuestionStateInUrl(minLogo: boolean, initialQuestions
const toggleQuestion = useCallback(
(questionProps: Question, options?: {moveToTop?: boolean; onlyRelated?: boolean}) => {
const {pageid, relatedQuestions} = questionProps

if (embedWithoutDetails) {
window.open(`https://aisafety.info/?state=${pageid}_`, '_blank')
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't like how this is getting even more magical. Would it be possible to do this somewhere closer to the actual click?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah ... this was the shared code between all places that open question details, so it's kinda DRY 🏝️

we should probably render real <a> links in the version of page without details, but if we do that in current components it would be more code that is still not self-explanatory and half-magic, even if not as much as this 🤔 I will try to make that version and see which will be less horrible 😅

the real solution would be to take the old code as inspiration and do the React components from scratch with all the existing use cases in mind, but I don't have time for that on this hackathon and not really the highest priority for the site either I guess 😭

Copy link
Collaborator Author

@Aprillion Aprillion Sep 3, 2023

Choose a reason for hiding this comment

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

the refactored version to use real links: #310 => discussed on Discord that looks better => updating this branch

@Aprillion Aprillion merged commit 001ade3 into master Sep 3, 2023
2 checks passed
@Aprillion Aprillion deleted the iframe branch September 3, 2023 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants