Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei0x309 committed Sep 17, 2024
1 parent f740715 commit 0e2a31c
Show file tree
Hide file tree
Showing 42 changed files with 704 additions and 479 deletions.
2 changes: 1 addition & 1 deletion apps/yup-live-desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "yup-live-tauri",
"version": "1.2.3"
"version": "1.4.2"
},
"tauri": {
"allowlist": {
Expand Down
3 changes: 2 additions & 1 deletion apps/yup-live-mobile/src/store/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const useMainStore = defineStore('main', {
forcedVersion: '',
updateMessage: 'The current version of the app is no longer supported. You must update to the latest version to continue using the app. Do you want to update now?',
updateUrl: 'https://play.google.com/store/apps/details?id=gf.info.yup',
updatePaused: false
updatePaused: false,
disableNativeLikes: false,
},
userData: {
account: '',
Expand Down
108 changes: 95 additions & 13 deletions apps/yup-live-mobile/src/views/CrossPostModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,37 @@
style="width: 2.3rem; height: 2.3rem; margin: auto"
/>
<label
for="castField"
:for="`post${index}`"
class="leading-7 text-sm text-gray-600 dark:text-gray-300"
>Content</label
>
<textarea
ref="txtEl"
id="castField"
v-model="post.postContent"
<div
:id="`post${index}`"
editable
:contenteditable="!isSendPost"
placeholder="Write here..."
class="txt-box w-full bg-stone-200 text-gray-800 rounded border border-gray-300 focus:border-blue-500 focus:ring-2 focus:ring-blue-200 h-36 text-base outline-none py-1 px-3 resize-none leading-6 transition-colors duration-200 ease-in-out"
@input="
() => {
postContentCharCount[index] = post.postContent.length;
}
"
>
</textarea>
(e: any) => {
post.postContent = e?.target?.textContent;
postContentCharCount[index] = post.postContent.length;
checkForMentions(post.postContent, index);
}
"
></div>
<MentionList
v-if="mentionsOpen"
style="padding: 0"
:mentions="mentions"
:positionCoords="mentionsCoords"
:loading="false"
@mention-selected="
(mention: any) => {
insertMention(mention, index);
}
"
/>

<small
>Character limit: {{ postContentCharCount[index] }} /
{{ maxCharCount }}</small
Expand Down Expand Up @@ -407,6 +422,9 @@ import { wait } from "shared/src";
import ProfileFarcasterIcon from "icons/src/profileFarcaster.vue";
import AddIcon from "icons/src/add.vue";
import SubstractIcon from "icons/src/substract.vue";
import MentionList from "components/post/mention.vue";
import { searchWeb3ProfileByHandle } from "shared/src/utils/requests/web3Profiles";
import { IWeb3Profile } from "shared/src/types/web3Profile";
export default defineComponent({
name: "CrossPost",
Expand Down Expand Up @@ -436,6 +454,7 @@ export default defineComponent({
IonList,
AddIcon,
SubstractIcon,
MentionList,
},
props: {
crossPost: {
Expand Down Expand Up @@ -516,6 +535,9 @@ export default defineComponent({
const isChannelSearching = ref(false);
const showFcChannel = ref(!!postPlatforms?.value?.includes("farcaster"));
let searchString = "";
const mentionsOpen = ref(false);
const mentionsCoords = ref({ x: 0, y: 0 });
const mentions = ref([]) as Ref<IWeb3Profile[]>;
const addToThread = () => {
if (posts.length > 30) {
Expand Down Expand Up @@ -857,11 +879,60 @@ export default defineComponent({
onMounted(() => {
if (props.shareLink) {
refTxtEl.value?.setSelectionRange(0, 0);
refTxtEl.value?.focus();
const el = document.getElementById("castField");
if (el) {
el.innerHTML = " " + props.shareLink;
el.focus();
}
}
});
const checkForMentions = async (text: string, index: number) => {
const checkMentions = text.match(/@[a-zA-Z0-9_]+$/gms);
if (checkMentions) {
const inputEl = document.getElementById(`post${index}`);
const inputElRect = inputEl?.getBoundingClientRect();
const range = window.getSelection()?.getRangeAt(0);
const rect = range?.getBoundingClientRect();
mentionsCoords.value = { x: rect?.x ?? 0, y: rect?.y ?? 0 };
mentionsCoords.value.x -= inputElRect?.x ?? 0;
mentionsCoords.value.y -= (inputElRect?.y ?? 0) / 3.5;
const searchMentions = await searchWeb3ProfileByHandle(
undefined,
checkMentions[0]
);
mentions.value = searchMentions ?? [];
mentionsOpen.value = true;
} else {
mentionsOpen.value = false;
}
};
const insertMention = (mention: IWeb3Profile, index: number) => {
const postEl = document.getElementById(`post${index}`);
// const range = window.getSelection()?.getRangeAt(0);
const mentionNode = document.createElement("span");
mentionNode.innerText = `@${mention.handle}`;
mentionNode.style.color = "coral";
mentionNode.style.fontWeight = "bold";
mentionNode.style.cursor = "pointer";
mentionNode.contentEditable = "false";
mentionNode.onclick = () => {
mentionsOpen.value = false;
};
if (postEl) {
postEl.innerHTML = postEl.innerHTML.replace(/@[a-zA-Z0-9_]+$/gms, "");
postEl.appendChild(mentionNode);
const sel = window.getSelection();
if (!sel) return;
sel.selectAllChildren(postEl);
sel.collapseToEnd();
posts[index].postContent = postEl.textContent ?? "";
}
mentionsOpen.value = false;
};
return {
openPostModal,
isSendPost,
Expand Down Expand Up @@ -901,6 +972,11 @@ export default defineComponent({
substractFromThread,
localReplyTo,
intialPlatforms,
checkForMentions,
mentionsOpen,
mentionsCoords,
mentions,
insertMention,
};
},
});
Expand All @@ -912,6 +988,12 @@ export default defineComponent({
--checkbox-background-checked: #405c252b;
}
[contenteditable="true"]:empty:before {
content: attr(placeholder);
pointer-events: none;
display: block; /* For Firefox */
}
.txt-box {
background-color: #a1a5a952;
border: 4px solid #3333339e;
Expand Down
17 changes: 16 additions & 1 deletion apps/yup-live-mobile/src/views/SettingsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,20 @@
@ion-change="changeSetting('accountTracking')"
></ion-toggle>
</ion-item>
<ion-item>
Disable like native propagation, this will make likes to not be forwarded
to native social networks.
</ion-item>
<ion-item>
<ion-label>Disable native propagation</ion-label>
<ion-toggle
:key="updateKey"
slot="end"
aria-label="Enable Feed Personalization"
:checked="store?.settings?.disableNativeLikes"
@ion-change="changeSetting('disableNativeLikes')"
></ion-toggle>
</ion-item>
</ion-list>
</div>
</ion-accordion>
Expand Down Expand Up @@ -521,7 +535,8 @@
<li>Identifier is your email or blueSky handle</li>
<li>
Password is either an app password(recommended) or your blue sky
account password.
account password, if you have 2-auth enabled you need to use an app
password.
</li>
<li>Login session will be forwarded to YUP API</li>
</ul></small
Expand Down
2 changes: 1 addition & 1 deletion apps/yup-live/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"typescript": "~5.1.3",
"vite": "^5.0.11",
"vite-plugin-eslint": "^1.8.1",
"vite-ssg": "^0.23.6",
"vite-ssg": "^0.23.8",
"vite-ssg-sitemap": "^0.4.3"
},
"removedDeps": {
Expand Down
4 changes: 4 additions & 0 deletions apps/yup-live/src/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ export default defineComponent({
mainStore.userData.authToken = localStorage.getItem("authToken") || "";
getConnected(mainStore, mainStore.userData.account, mainStore.userData.address);
mainStore.isLoggedIn = true;
if (mainStore.settings) {
mainStore.settings.disableNativeLikes =
localStorage.getItem("disableLikeNativePropagation") === "true";
}
collectionStore.collectionsPromise = getCollections(
collectionStore,
mainStore.userData.account
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ header .loggedBtn {
top: 0.1rem;
box-shadow: inset -1px -1px 3rem 2px var(--logoBg), -2px 2px 2px 2px var(--logoBg),
2px -2px 2px 2px var(--logoBg);
margin-left: 0.6rem;
}
.connectButton {
Expand Down
Loading

0 comments on commit 0e2a31c

Please sign in to comment.