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

Implement zoomable images #13

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@types/dompurify": "^2.4.0",
"dompurify": "^3.0.0",
"link-preview-js": "^3.0.4",
"medium-zoom": "^1.0.8",
"nostr-tools": "^1.4.1",
"sass": "^1.58.0",
"solid-js": "^1.6.6"
Expand Down
2 changes: 1 addition & 1 deletion src/components/EmbeddedNote/EmbeddedNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const EmbeddedNote: Component<{ note: PrimalNote, mentionedUsers?: Record<string
parseNpubLinks(
parsedContent(
highlightHashtags(
parseNote2(props.note.post.content)
parseNote2(props.note.post.content).urlified
),
),
props.note,
Expand Down
2 changes: 1 addition & 1 deletion src/components/NewNote/EditBox/EditBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ const EditBox: Component<{ replyToNote?: PrimalNote, onClose?: () => void, idPre


const parseForReferece = (value: string) => {
const content = replaceLinkPreviews(parseUserMentions(highlightHashtags(parseNote1(value))));
const content = replaceLinkPreviews(parseUserMentions(highlightHashtags(parseNote1(value).urlified)));

parseNpubLinks(content);
parseNoteLinks(content);
Expand Down
22 changes: 8 additions & 14 deletions src/components/Note/Note.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,45 +52,37 @@
}
}


.postLink {
.container {
text-decoration: none;
color: unset;
margin: 0px;
padding: 16px 20px;
// background: var(--brand-gradient-vertical);
background-color: var(--background-card);
border-radius: 8px;
display: block;
transition: 0.2s padding;
margin-top: 8px;

>div {
border-radius: 4px;
transition: 0.2s border-radius ease-out;
}

// &:hover {
// padding-left: 4px;
// transition: 0.2s padding;
// border-radius: 4px;
// >div {
// border-radius: 0px 4px 4px 0px;
// transition: 0.2s border-radius ease-out;
// }
// }
}

.repostedBy {
padding-bottom: 16px;
display: flex;

>span {
>a {
margin-inline: 5px;
}

color: var(--text-tertiary);
font-size: 16px;
line-height: 16px;
font-weight: 400;

>span {
text-transform: lowercase;
}
Expand All @@ -101,17 +93,19 @@
@media only screen and (max-width: 720px) {
.postLink {
width: 100vw;

.post {
width: 100%;
// grid-template-columns: 62px 1fr;
margin-left: 0px;
margin-right: 0px;
padding-right: 0px;

.content {
margin-left: 0;
}
}

}

}
}
59 changes: 20 additions & 39 deletions src/components/Note/Note.tsx
Original file line number Diff line number Diff line change
@@ -1,57 +1,38 @@
import { A } from '@solidjs/router';
import { Component, Show } from 'solid-js';
import { PrimalNote } from '../../types/primal';
import ParsedNote from '../ParsedNote/ParsedNote';
import NoteFooter from './NoteFooter/NoteFooter';
import NoteHeader from './NoteHeader/NoteHeader';

import styles from './Note.module.scss';
import { useThreadContext } from '../../contexts/ThreadContext';
import { useIntl } from '@cookbook/solid-intl';
import { truncateNpub } from '../../stores/profile';
import { note as t } from '../../translations';
import { A } from "@solidjs/router";
import { Component, Show } from "solid-js";
import { PrimalNote } from "../../types/primal";
import ParsedNote from "../ParsedNote/ParsedNote";
import NoteFooter from "./NoteFooter/NoteFooter";
import NoteHeader from "./NoteHeader/NoteHeader";

import styles from "./Note.module.scss";
import { useIntl } from "@cookbook/solid-intl";
import { truncateNpub } from "../../stores/profile";
import { note as t } from "../../translations";

const Note: Component<{ note: PrimalNote }> = (props) => {

const threadContext = useThreadContext();
const intl = useIntl();

const repost = () => props.note.repost;

const navToThread = (note: PrimalNote) => {
threadContext?.actions.setPrimaryNote(note);
};

const reposterName = () => {
const r = repost();

if (!r) {
return '';
return "";
}

return r.user?.displayName ||
r.user?.name ||
truncateNpub(r.user.npub);
}
return r.user?.displayName || r.user?.name || truncateNpub(r.user.npub);
};

return (
<A
class={styles.postLink}
href={`/e/${props.note?.post.noteId}`}
onClick={() => navToThread(props.note)}
data-event={props.note.post.id}
data-event-bech32={props.note.post.noteId}
>
<div class={styles.container}>
<Show when={repost()}>
<div class={styles.repostedBy}>
<div class={styles.repostIcon}></div>
<span>
<A href={`/p/${repost()?.user.npub}`} >
{reposterName()}
</A>
<span>
{intl.formatMessage(t.reposted)}
</span>
<A href={`/profile/${repost()?.user.npub}`}>{reposterName()}</A>
<span>{intl.formatMessage(t.reposted)}</span>
</span>
</div>
</Show>
Expand All @@ -64,8 +45,8 @@ const Note: Component<{ note: PrimalNote }> = (props) => {
<NoteFooter note={props.note} />
</div>
</div>
</A>
)
}
</div>
);
};

export default Note;
12 changes: 12 additions & 0 deletions src/components/ParsedNote/ParsedNote.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,15 @@
.error {
color: var(--brand-1);
}

.imagesContainer {
display: flex;
flex-direction: column;
gap: 6px;
}

.postLink {
text-decoration: none !important;
color: unset;
margin: 0px;
}
Loading