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

Update from main #489

Merged
merged 45 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ecfcc68
Add TheDesk
cheeaun Apr 5, 2024
7fa0b4f
Upgrade dependencies
cheeaun Apr 5, 2024
4e59409
Pixelfed-related fixes
cheeaun Apr 9, 2024
5c9f6ba
Fix followers list failing if familiar followers fail
cheeaun Apr 10, 2024
b851741
Make notifications settings icon less significant
cheeaun Apr 10, 2024
c9124bf
Change double-tap zoom to match mobile expectations
cheeaun Apr 10, 2024
8b5fee3
Just sub it once
cheeaun Apr 10, 2024
5083463
Show empty copy when no notifications at all
cheeaun Apr 11, 2024
6092096
Special fallback handling when media object doesn't have enough info
cheeaun Apr 11, 2024
6e73728
Only show data-read-more when it's available
cheeaun Apr 11, 2024
a0d2037
Early implementation of media-first UI experience
cheeaun Apr 11, 2024
0efa39b
Sometimes it returns a preview image without dimenions
cheeaun Apr 11, 2024
c3bcf3d
Try make Safari show video preview
cheeaun Apr 11, 2024
f7c69e5
Adding new self-hosted instance of Phanpy
ultramookie Apr 12, 2024
7fb56d9
Merge pull request #493 from ultramookie/ultramookie-patch-1
cheeaun Apr 12, 2024
9285a0b
Test upgrade react-hotkeys-hook for the keys fix
cheeaun Apr 12, 2024
aefda31
Temporary quick fix, remove dash from hashtag regex
cheeaun Apr 12, 2024
e782cc0
Refactor set/get current account ID
cheeaun Apr 12, 2024
501e432
Don't set onlyMedia if not set
cheeaun Apr 12, 2024
2faf9b4
Pixelfed needs remote which is opposite of local lol
cheeaun Apr 12, 2024
6f22ec3
Fix missing idempotency key
cheeaun Apr 13, 2024
ec65163
More breathing space
cheeaun Apr 13, 2024
df3aca7
Open media + post view for wider viewports
cheeaun Apr 13, 2024
7be6208
Fix notifications for Pixelfed
cheeaun Apr 13, 2024
260bb87
More media-first adjustments
cheeaun Apr 13, 2024
5babdc9
Fix width/height not set
cheeaun Apr 13, 2024
c286562
Media-first style adjustments
cheeaun Apr 13, 2024
94996d0
Fix width issue
cheeaun Apr 13, 2024
342ff20
Document `PHANPY_IMG_ALT_API_URL`
cheeaun Apr 14, 2024
6f8f3e4
Change -35deg to 145deg prevents stripes animation
cheeaun Apr 14, 2024
afdfdb8
Media-first style adjustments
cheeaun Apr 14, 2024
06c6360
More support for Pixelfed
cheeaun Apr 14, 2024
cd59201
Undo back to -45deg, not everything need 135deg
cheeaun Apr 14, 2024
57390a2
No need background if there's pre-meta before it
cheeaun Apr 15, 2024
304ce5a
Experiment dynamic change of parent
cheeaun Apr 15, 2024
294ab2b
Just put in this commented test notification
cheeaun Apr 15, 2024
701b9e9
More media-first styling changes
cheeaun Apr 15, 2024
e2f3959
Might as well add more supports
cheeaun Apr 15, 2024
9a6364a
Obviously got to flex my scroll-driven animation CSSkillz
cheeaun Apr 15, 2024
a68dccd
Fix rerender bug with followed hashtag parent
cheeaun Apr 15, 2024
44e910b
Fix wrong carousel math
cheeaun Apr 15, 2024
effbe18
Revert "Test upgrade react-hotkeys-hook for the keys fix"
cheeaun Apr 15, 2024
f4b95d2
Maybe this helps?
cheeaun Apr 16, 2024
55ad650
Fix margins
cheeaun Apr 16, 2024
b9058c6
Debounced auto-submit for GIF search field
cheeaun Apr 17, 2024
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ Available variables:
- May specify a self-hosted Lingva instance, powered by either [lingva-translate](https://github.com/thedaviddelta/lingva-translate) or [lingva-api](https://github.com/cheeaun/lingva-api)
- List of fallback instances hard-coded in `/.env`
- [↗️ List of lingva-translate instances](https://github.com/thedaviddelta/lingva-translate?tab=readme-ov-file#instances)
- `PHANPY_IMG_ALT_API_URL` (optional, no defaults):
- API endpoint for self-hosted instance of [img-alt-api](https://github.com/cheeaun/img-alt-api).
- If provided, a setting will appear for users to enable the image description generator in the composer. Disabled by default.
- `PHANPY_GIPHY_API_KEY` (optional, no defaults):
- API key for [GIPHY](https://developers.giphy.com/). See [API docs](https://developers.giphy.com/docs/api/).
- If provided, a setting will appear for users to enable the GIF picker in the composer. Disabled by default.
Expand All @@ -205,6 +208,7 @@ These are self-hosted by other wonderful folks.
- [phanpy.hear-me.social](https://phanpy.hear-me.social) by [@admin@hear-me.social](https://hear-me.social/@admin)
- [phanpy.fulda.social](https://phanpy.fulda.social) by [@Ganneff@fulda.social](https://fulda.social/@Ganneff)
- [phanpy.crmbl.uk](https://phanpy.crmbl.uk) by [@snail@crmbl.uk](https://mstdn.crmbl.uk/@snail)
- [halo.mookiesplace.com](https://halo.mookiesplace.com) by [@mookie@mookiesplace.com](https://mookiesplace.com/@mookie)

> Note: Add yours by creating a pull request.

Expand Down Expand Up @@ -256,6 +260,7 @@ And here I am. Building a Mastodon web client.
- [Tusked](https://tusked.app/)
- [Mastodon Glitch Edition (standalone frontend)](https://iceshrimp.dev/iceshrimp/masto-fe-standalone)
- [Mangane](https://github.com/BDX-town/Mangane)
- [TheDesk](https://github.com/cutls/TheDesk)
- [More...](https://github.com/hueyy/awesome-mastodon/#clients)

## 💁‍♂️ Notice to all other social media client developers
Expand Down
256 changes: 128 additions & 128 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"@trivago/prettier-plugin-sort-imports": "~4.3.0",
"postcss": "~8.4.38",
"postcss-dark-theme-class": "~1.2.1",
"postcss-preset-env": "~9.5.2",
"postcss-preset-env": "~9.5.4",
"twitter-text": "~3.1.0",
"vite": "~5.2.6",
"vite": "~5.2.8",
"vite-plugin-generate-file": "~0.1.1",
"vite-plugin-html-config": "~1.0.11",
"vite-plugin-pwa": "~0.19.7",
Expand Down
38 changes: 37 additions & 1 deletion src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,41 @@ a[href^='http'][rel*='nofollow']:visited:not(:has(div)) {
}
}
}

.deck-container-media-first {
.timeline {
> li:not(.timeline-item-carousel, .timeline-item-container) {
&:has(.status-media-first) {
@media (min-width: 40em) {
width: fit-content;
max-width: min(480px, 100%);
}

background-color: transparent !important;
border: 0 !important;
box-shadow: none !important;
margin-inline: auto !important;

&:not(:first-child) {
margin-block: 32px;
}

&:has(.skeleton) {
width: 100%;
}
}

&:has(.media[data-orientation='landscape']) {
max-width: 100%;
}
}

.status-link:has(.status-media-first):hover {
background-color: transparent;
}
}
}

.timeline.grow {
/* min-height: 100vh;
min-height: 100dvh; */
Expand Down Expand Up @@ -1882,7 +1917,8 @@ body > .szh-menu-container {
/* two columns only */
grid-template-columns: repeat(2, 1fr);
}
.szh-menu .menu-horizontal:has(> .szh-menu__item:only-child) {
.szh-menu .menu-horizontal:has(> .szh-menu__item:only-child),
.szh-menu .menu-horizontal:has(> .szh-menu__submenu:only-child) {
grid-template-columns: 1fr;
}
.szh-menu .menu-horizontal > .szh-menu__item:not(:only-child):first-child,
Expand Down
4 changes: 2 additions & 2 deletions src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { getAccessToken } from './utils/auth';
import focusDeck from './utils/focus-deck';
import states, { initStates, statusKey } from './utils/states';
import store from './utils/store';
import { getCurrentAccount } from './utils/store-utils';
import { getCurrentAccount, setCurrentAccountID } from './utils/store-utils';
import './utils/toast-alert';

window.__STATES__ = states;
Expand Down Expand Up @@ -338,7 +338,7 @@ function App() {
window.__IGNORE_GET_ACCOUNT_ERROR__ = true;
const account = getCurrentAccount();
if (account) {
store.session.set('currentAccount', account.info.id);
setCurrentAccountID(account.info.id);
const { client } = api({ account });
const { instance } = client;
// console.log('masto', masto);
Expand Down
72 changes: 38 additions & 34 deletions src/components/account-info.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import shortenNumber from '../utils/shorten-number';
import showToast from '../utils/show-toast';
import states, { hideAllModals } from '../utils/states';
import store from '../utils/store';
import { updateAccount } from '../utils/store-utils';
import { getCurrentAccountID, updateAccount } from '../utils/store-utils';
import supports from '../utils/supports';

import AccountBlock from './account-block';
import Avatar from './avatar';
Expand Down Expand Up @@ -198,10 +199,7 @@ function AccountInfo({
}
}

const isSelf = useMemo(
() => id === store.session.get('currentAccount'),
[id],
);
const isSelf = useMemo(() => id === getCurrentAccountID(), [id]);

useEffect(() => {
const infoHasEssentials = !!(
Expand Down Expand Up @@ -254,12 +252,13 @@ function AccountInfo({
// On first load, fetch familiar followers, merge to top of results' `value`
// Remove dups on every fetch
if (firstLoad) {
const familiarFollowers = await masto.v1.accounts.familiarFollowers.fetch(
{
let familiarFollowers = [];
try {
familiarFollowers = await masto.v1.accounts.familiarFollowers.fetch({
id: [id],
},
);
familiarFollowersCache.current = familiarFollowers[0].accounts;
});
} catch (e) {}
familiarFollowersCache.current = familiarFollowers?.[0]?.accounts || [];
newValue = [
...familiarFollowersCache.current,
...value.filter(
Expand Down Expand Up @@ -919,7 +918,7 @@ function RelatedActions({

useEffect(() => {
if (info) {
const currentAccount = store.session.get('currentAccount');
const currentAccount = getCurrentAccountID();
let currentID;
(async () => {
if (sameInstance && authenticated) {
Expand Down Expand Up @@ -1093,16 +1092,18 @@ function RelatedActions({
<Icon icon="translate" />
<span>Translate bio</span>
</MenuItem>
<MenuItem
onClick={() => {
setShowPrivateNoteModal(true);
}}
>
<Icon icon="pencil" />
<span>
{privateNote ? 'Edit private note' : 'Add private note'}
</span>
</MenuItem>
{supports('@mastodon/profile-private-note') && (
<MenuItem
onClick={() => {
setShowPrivateNoteModal(true);
}}
>
<Icon icon="pencil" />
<span>
{privateNote ? 'Edit private note' : 'Add private note'}
</span>
</MenuItem>
)}
{following && !!relationship && (
<>
<MenuItem
Expand Down Expand Up @@ -1451,19 +1452,22 @@ function RelatedActions({
</MenuItem>
</>
)}
{currentAuthenticated && isSelf && standalone && (
<>
<MenuDivider />
<MenuItem
onClick={() => {
setShowEditProfile(true);
}}
>
<Icon icon="pencil" />
<span>Edit profile</span>
</MenuItem>
</>
)}
{currentAuthenticated &&
isSelf &&
standalone &&
supports('@mastodon/profile-edit') && (
<>
<MenuDivider />
<MenuItem
onClick={() => {
setShowEditProfile(true);
}}
>
<Icon icon="pencil" />
<span>Edit profile</span>
</MenuItem>
</>
)}
{import.meta.env.DEV && currentAuthenticated && isSelf && (
<>
<MenuDivider />
Expand Down
2 changes: 1 addition & 1 deletion src/components/compose.css
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@

#compose-container .form-visibility-direct {
--yellow-stripes: repeating-linear-gradient(
-45deg,
135deg,
var(--reply-to-faded-color),
var(--reply-to-faded-color) 10px,
var(--reply-to-faded-color) 10px,
Expand Down
13 changes: 11 additions & 2 deletions src/components/compose.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const MENTION_RE = new RegExp(

// AI-generated, all other regexes are too complicated
const HASHTAG_RE = new RegExp(
`(^|[^=\\/\\w])(#[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?)(?![\\/\\w])`,
`(^|[^=\\/\\w])(#[a-z0-9_]+([a-z0-9_.]+[a-z0-9_]+)?)(?![\\/\\w])`,
'ig',
);

Expand Down Expand Up @@ -988,7 +988,11 @@ function Compose({
} else {
try {
newStatus = await masto.v1.statuses.create(params, {
idempotencyKey: UID.current,
requestInit: {
headers: {
'Idempotency-Key': UID.current,
},
},
});
} catch (_) {
// If idempotency key fails, try again without it
Expand Down Expand Up @@ -2370,6 +2374,10 @@ function GIFPickerModal({ onClose = () => {}, onSelect = () => {} }) {
qRef.current?.focus();
}, []);

const debouncedOnInput = useDebouncedCallback(() => {
fetchGIFs({ offset: 0 });
}, 1000);

return (
<div id="gif-picker-sheet" class="sheet">
{!!onClose && (
Expand All @@ -2396,6 +2404,7 @@ function GIFPickerModal({ onClose = () => {}, onSelect = () => {} }) {
autocapitalize="off"
spellCheck="false"
dir="auto"
onInput={debouncedOnInput}
/>
<input
type="image"
Expand Down
3 changes: 2 additions & 1 deletion src/components/media-post.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import FilterContext from '../utils/filter-context';
import { isFiltered } from '../utils/filters';
import states, { statusKey } from '../utils/states';
import store from '../utils/store';
import { getCurrentAccountID } from '../utils/store-utils';

import Media from './media';

Expand Down Expand Up @@ -88,7 +89,7 @@ function MediaPost({
};

const currentAccount = useMemo(() => {
return store.session.get('currentAccount');
return getCurrentAccountID();
}, []);
const isSelf = useMemo(() => {
return currentAccount && currentAccount === accountId;
Expand Down
Loading