Skip to content

Commit

Permalink
added new design input (toggleable)
Browse files Browse the repository at this point in the history
some translation fixes
i forgor
  • Loading branch information
OfficialDakari committed Aug 2, 2024
1 parent 864d792 commit 81627b6
Show file tree
Hide file tree
Showing 23 changed files with 233 additions and 202 deletions.
4 changes: 1 addition & 3 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
github: ajbura
liberapay: ajbura
open_collective: cinny
github: officialdakari
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ body:
attributes:
value: |
## First of all
1. Please search for [existing issues](https://github.com/ajbura/cinny/issues?q=is%3Aissue) about this problem first.
2. Make sure Cinny is up to date.
3. Make sure it's an issue with Cinny and not something else you are using.
1. Please search for [existing issues](https://github.com/OfficialDakari/Extera/issues?q=is%3Aissue) about this problem first.
2. Make sure Extera is up to date.
3. Make sure it's an issue with Extera and not something else you are using.
4. Remember to be friendly.
- type: textarea
Expand Down Expand Up @@ -40,11 +40,11 @@ body:
id: info
attributes:
label: Platform and versions
description: "Provide OS, browser and Cinny version with your Homeserver."
description: "Provide OS, browser and Extera version with your Homeserver."
placeholder: |
1. OS: [e.g. Windows 10, MacOS]
2. Browser: [e.g. chrome 99.5, firefox 97.2]
3. Cinny version: [e.g. 1.8.1 (app.cinny.in)]
3. Extera version: [e.g. 1.8.1 (extera.officialdakari.ru)]
4. Matrix homeserver: [e.g. matrix.org]
render: shell
validations:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
contact_links:
- name: 💬 Matrix Chat
url: https://matrix.to/#/#cinny:matrix.org
about: Ask questions and talk to other Cinny users and the maintainers
url: https://matrix.to/#/#extera:officialdakari.ru
about: Ask questions and talk to other Extera users and the maintainers
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Please read https://github.com/ajbura/cinny/blob/dev/CONTRIBUTING.md before submitting your pull request -->
<!-- Please read https://github.com/OfficialDakari/Extera/blob/dev/CONTRIBUTING.md before submitting your pull request -->

### Description
<!-- Please include a summary of the change. Please also include relevant motivation and context. List any dependencies that are required for this change. -->
Expand Down
2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Reporting a Vulnerability

**If you've found a security vulnerability, please report it to cinnyapp@gmail.com**
**If you've found a security vulnerability, please report it to security@officialdakari.ru**
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Contributing to Cinny
# Contributing to Extera

First off, thanks for taking the time to contribute! ❤️

All types of contributions are encouraged and valued. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉

> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
> - Star the project
> - Tweet about it (tag @cinnyapp)
> - Tweet about it
> - Refer this project in your project's readme
> - Mention the project at local meetups and tell your friends/colleagues
> - [Donate to us](https://cinny.in/#sponsor)
> - [Donate to us](https://officialdakari.ru/sponsor/)
## Bug reports

Bug reports and feature suggestions must use descriptive and concise titles and be submitted to [GitHub Issues](https://github.com/ajbura/cinny/issues). Please use the search function to make sure that you are not submitting duplicates, and that a similar report or request has not already been resolved or rejected.
Bug reports and feature suggestions must use descriptive and concise titles and be submitted to [GitHub Issues](https://github.com/OfficialDakari/Extera/issues). Please use the search function to make sure that you are not submitting duplicates, and that a similar report or request has not already been resolved or rejected.

## Pull requests

Expand All @@ -36,7 +36,7 @@ It is not always possible to phrase every change in such a manner, but it is des

Also, we use [ESLint](https://eslint.org/) for clean and stylistically consistent code syntax, so make sure your pull request follow it.

**For any query or design discussion, join our [Matrix room](https://matrix.to/#/#cinny:matrix.org).**
**For any query or design discussion, join our [Matrix room](https://matrix.to/#/#extera:officialdakari.ru).**

## Helpful links
- [BEM methodology](http://getbem.com/introduction/)
Expand Down
4 changes: 2 additions & 2 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
* [x] Setting to set Presence Status (Online/offline/unavailable)
* [x] Setting to set status message
* [x] Ghost mode (stop sending read receipts and typing status)
* [ ] Fix keyboard hiding when removing inline element in message editor (underlying library issue)
* [ ] Mobile improvements (Add support for back button everywhere, like hide ImageViewer with back button)
* [x] Fix keyboard hiding when removing inline element in message editor (underlying library issue)
* [x] Mobile improvements (Add support for back button everywhere, like hide ImageViewer with back button)
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<meta property="og:title" content="Extera" />
<meta property="og:url" content="https://extera.officialdakari.ru" />
<meta property="og:image" content="https://cinny.in/assets/favicon-48x48.png" />
<meta property="og:image" content="https://extera-public.officialdakari.ru/res/android/android-chrome-icon-72x72.png" />
<meta property="og:description" content="Additional cool features and little design improvements for Cinny." />
<meta name="theme-color" content="#000000" />

Expand Down
9 changes: 9 additions & 0 deletions src/app/components/editor/Editor.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ export const Editor = style([
},
]);

export const EditorNew = style([
DefaultReset,
{
backgroundColor: color.SurfaceVariant.Container,
color: color.SurfaceVariant.OnContainer,
overflow: 'hidden',
},
]);

export const EditorOptions = style([
DefaultReset,
{
Expand Down
6 changes: 4 additions & 2 deletions src/app/components/editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type CustomEditorProps = {
onChange?: (value: string) => void;
onPaste?: ClipboardEventHandler;
textAreaRef: React.RefObject<HTMLTextAreaElement>;
newDesign?: boolean;
};

export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
Expand All @@ -50,7 +51,8 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
onKeyUp,
onChange,
onPaste,
textAreaRef
textAreaRef,
newDesign
}, ref) => {
const updateRows = (target: HTMLTextAreaElement) => {
target.rows = target.value.split('\n').length;
Expand Down Expand Up @@ -80,7 +82,7 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
onChange(newText);
};
return (
<div ref={ref} className={css.Editor}>
<div ref={ref} className={newDesign ? css.EditorNew : css.Editor}>
{top}
<Box alignItems="Start">
{before && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function UserMentionAutocomplete({
const ta = textAreaRef.current;
if (!ta) return;

const result: string = `{${uId}}`;
const result: string = `{${uId == roomAliasOrId ? '@room' : uId}}`;

var v = ta.value;
v = `${v.slice(0, query.range.index)}${result}${v.slice(query.range.index + query.range.length)}`;
Expand All @@ -115,10 +115,6 @@ export function UserMentionAutocomplete({

useKeyDown(window, (evt: KeyboardEvent) => {
onTabPress(evt, () => {
if (query.text === 'room') {
handleAutocomplete(roomAliasOrId, '@room');
return;
}
if (autoCompleteMembers.length === 0) {
const userId = userIdFromQueryText(mx, query.text);
handleAutocomplete(userId, userId);
Expand Down
13 changes: 8 additions & 5 deletions src/app/components/editor/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const roomMentionRegexp = /{([^\|]+)\|([#!][A-Za-z0-9\._%#\+\-]+:[a-z0-9\
export const anyTagRegexp = /{(:([a-zA-Z0-9\-_\.]+):(mxc:\/\/[a-z0-9\.\-]+\.[a-z]{2,}\/[a-zA-Z0-9_\-]+):|(@[a-zA-Z0-9\._=\-]+:[a-z0-9\.\-]+\.[a-z]{2,})|([^\|]+)\|([#!][A-Za-z0-9\._%#\+\-]+:[a-z0-9\.\-]+\.[a-z]{2,}))}/gi;
export const deleteEndRegexp = /{(:([a-zA-Z0-9\-_\.]+):(mxc:\/\/[a-z0-9\.\-]+\.[a-z]{2,}\/[a-zA-Z0-9_\-]+):|(@[a-zA-Z0-9\._=\-]+:[a-z0-9\.\-]+\.[a-z]{2,})|([^\|]+)\|([#!][A-Za-z0-9\._%#\+\-]+:[a-z0-9\.\-]+\.[a-z]{2,}))([^}]|$)/gi;
export const deleteStartRegexp = /(^|[^{])(:([a-zA-Z0-9\-_\.]+):(mxc:\/\/[a-z0-9\.\-]+\.[a-z]{2,}\/[a-zA-Z0-9_\-]+):|(@[a-zA-Z0-9\._=\-]+:[a-z0-9\.\-]+\.[a-z]{2,})|([^\|]+)\|([#!][A-Za-z0-9\._%#\+\-]+:[a-z0-9\.\-]+\.[a-z]{2,}))}/gi;
export const everyoneMentionRegexp = /{@room}/g;

export const toMatrixCustomHTML = (
content: string,
Expand All @@ -39,14 +40,16 @@ export const toMatrixCustomHTML = (
)
.replaceAll(emojiRegexp, (match: string, shortcode: string, mxc: string) => `<img data-mx-emoticon height="32" src="${mxc}" alt=":${shortcode}:" title=":${shortcode}:">`)
.replaceAll(userMentionRegexp, (match: string, mxId: string) => `<a href="https://matrix.to/#/${mxId}">@${getDisplayName(mxId)}</a>`)
.replaceAll(roomMentionRegexp, (match: string, name: string, id: string) => `<a href="https://matrix.to/#/${id}">#${name}</a>`);
.replaceAll(roomMentionRegexp, (match: string, name: string, id: string) => `<a href="https://matrix.to/#/${id}">#${name}</a>`)
.replaceAll(everyoneMentionRegexp, '@room');
};

export const toPlainText = (content: string, getDisplayName: any): string => {
// и этот кал будет лежать на гитхабе
return content.replaceAll(emojiRegexp, (match: string, shortcode: string, mxc: string) => `:${shortcode}:`)
.replaceAll(userMentionRegexp, (match: string, mxId: string) => `@${getDisplayName(mxId)}`)
.replaceAll(roomMentionRegexp, (match: string, name: string, id: string) => `#${name}`);
.replaceAll(userMentionRegexp, (match: string, mxId: string) => `${getDisplayName(mxId)}`)
.replaceAll(roomMentionRegexp, (match: string, name: string, id: string) => `#${name}`)
.replaceAll(everyoneMentionRegexp, '@room');
};

type Mentions = {
Expand All @@ -63,9 +66,9 @@ export const getMentions = (content: string): Mentions => {
}
}
// TODO Implement @room checking
//const room = /{@room}/g.test(content);
const room = /{@room}/g.test(content);
return {
user_ids //, room
user_ids, room
};
};

Expand Down
68 changes: 49 additions & 19 deletions src/app/components/emoji-board/EmojiBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import React, {
import {
Badge,
Box,
Button,
Chip,
Icon,
IconButton,
Expand Down Expand Up @@ -50,6 +51,9 @@ import { useThrottle } from '../../hooks/useThrottle';
import { addRecentEmoji } from '../../plugins/recent-emoji';
import { mobileOrTablet } from '../../utils/user-agent';
import { getText } from '../../../lang';
import { useSetting } from '../../state/hooks/settings';
import { settingsAtom } from '../../state/settings';
import { openJoinAlias } from '../../../client/action/navigation';

const RECENT_GROUP_ID = 'recent_group';
const SEARCH_GROUP_ID = 'search_group';
Expand Down Expand Up @@ -655,6 +659,9 @@ export function EmojiBoard({
const emojiPreviewRef = useRef<HTMLDivElement>(null);
const emojiPreviewTextRef = useRef<HTMLParagraphElement>(null);

// Remove #emoji:officialdakari.ru advertisement
const [hideAdvert, setHideAdvert] = useSetting(settingsAtom, 'hideEmojiAdvert');

const searchList = useMemo(() => {
let list: Array<ExtendedPackImage | IEmoji> = [];
list = list.concat(imagePacks.flatMap((pack) => pack.getImagesFor(usage)));
Expand All @@ -668,6 +675,15 @@ export function EmojiBoard({
SEARCH_OPTIONS
);

const handleGetFreeEmojis = () => {
requestClose();
openJoinAlias('#emoji:officialdakari.ru');
};

const handleDismissFreeEmojis = () => {
setHideAdvert(true);
};

const handleOnChange: ChangeEventHandler<HTMLInputElement> = useDebounce(
useCallback(
(evt) => {
Expand Down Expand Up @@ -842,30 +858,44 @@ export function EmojiBoard({
</Sidebar>
}
footer={
emojiTab ? (
<Footer>
<Box
display="InlineFlex"
ref={emojiPreviewRef}
className={css.EmojiPreview}
alignItems="Center"
justifyContent="Center"
>
😃
</Box>
<Text ref={emojiPreviewTextRef} size="H5" truncate>
:smiley:
</Text>
</Footer>
) : (
imagePacks.length > 0 && (
<>
{emojiTab ? (
<Footer>
<Box
display="InlineFlex"
ref={emojiPreviewRef}
className={css.EmojiPreview}
alignItems="Center"
justifyContent="Center"
>
😃
</Box>
<Text ref={emojiPreviewTextRef} size="H5" truncate>
:smiley:
</Text>
</Footer>
)
)
) : (
imagePacks.length > 0 && (
<Footer>
<Text ref={emojiPreviewTextRef} size="H5" truncate>
:smiley:
</Text>
</Footer>
)
)}
{!hideAdvert && (
<Box shrink="No" className={css.Footer} display='InlineFlex' justifyContent='SpaceBetween' gap="300" alignItems="Center">
<Text size="H5">
Free cool emojis
</Text>
<div>
<Button size='300' variant='Success' onClick={handleGetFreeEmojis}>Get</Button>
&nbsp;
<Button size='300' variant='Secondary' onClick={handleDismissFreeEmojis}>Dismiss</Button>
</div>
</Box>
)}
</>
}
>
<Content>
Expand Down
Loading

0 comments on commit 81627b6

Please sign in to comment.