-
Notifications
You must be signed in to change notification settings - Fork 1
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
/explore #55
Draft
aofn
wants to merge
924
commits into
main
Choose a base branch
from
explore
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
/explore #55
Changes from 250 commits
Commits
Show all changes
924 commits
Select commit
Hold shift + click to select a range
34f9922
Merge branch 'explore' of andirueckel.github.com:medienhaus/medienhau…
andirueckel 5b6fa0b
style: unify text sizes in shadcn components
andirueckel 50b1154
refactor: adapt DataList.js to main
aofn 56c60c0
refactor: use more appropriate icon for kicking users
aofn 072f76e
style: fix Button ghost variant; fix DropdownMenu
andirueckel 7eb19a6
Merge branch 'explore' of andirueckel.github.com:medienhaus/medienhau…
andirueckel 287eb7d
refactor: add icons to dropdown menu
aofn e01f11d
style: fix DropdownMenuItem grid and colors
andirueckel 8030bca
chore: fix eslint errors
andirueckel 0f6dab6
revert: remove eslint "missing dependencies" from useEffect
andirueckel 9fd0636
fix: copy location.protocol in addition to hostname and path
andirueckel a9cf1cd
chore: format components/UI/ServiceLink.js
andirueckel 7fd6cf3
style: remove css fill style from Icon.js
andirueckel 2b8559f
chore: wrap svg icons in Icon component for DropdownMenuItem
andirueckel 59c03f4
chore: add/fix/improve/update localized texts
andirueckel ca10a4f
chore: add localized text
andirueckel 513ff26
refactor: add JSDoc, use Popover to describe chat templates.
aofn 11c033e
add Popover to packages
aofn daac211
chore: remove unused/unwanted tailwind classes
andirueckel 4c622a0
refactor: add chat templates to presets.js and use them in AddNewChat.js
aofn 4ac94db
style: fix font-weight of KnockCard headline components
andirueckel 77b03d1
chore: remove unused radix package
aofn a49dc3b
chore: add translations for chat templates
aofn 1355a4b
fix: use correct translation in both useEffects
andirueckel dbe2cea
merge explore into chat-template
aofn 62b1e3b
Merge remote-tracking branch 'origin/explore' into chat-template
aofn fef17c1
refactor: move emojis in front of text
aofn 50978cc
Merge pull request #148 from medienhaus/chat-template
aofn ec3276e
chore: update todos
aofn eddd6b6
style: make info button square in new chat dialog
andirueckel c75e802
fix: hydrate room content correctly and improve error handling
aofn 2fcbca1
chore: remove console.log
aofn 25742f4
chore: wrap individual strings in t() function
andirueckel f876a14
feat: add sonner component
aofn b48e981
refactor: add sonner to app
aofn 2f29f87
fix: use correct locales file for etherpad
andirueckel 796dc6a
fix: set correct locales namespace for translation strings
andirueckel 883320c
merge main into explore and adapt
aofn 7f5daca
Merge remote-tracking branch 'origin/explore' into explore
aofn 4f253f3
Merge branch 'error-sonner' into explore
aofn 6bfb761
chore: remove trailing whitespaces
andirueckel 895c31e
style: element switches shall be pill-shaped
andirueckel 6abb904
refactor: display error in toast to avoid breaking the layout
aofn 0e68fff
Merge remote-tracking branch 'origin/explore' into explore
aofn 3a2ac6e
style: element invite bar without rounded corners, please
andirueckel 6bbb59c
Merge branch 'main' into explore
andirueckel dc21fbe
refactor: close modal after successfully adding/creating items/contex…
aofn f29ef28
chore: add missing locales for new changes in /explore
andirueckel 140e322
Merge pull request #149 from medienhaus/success-sonner
andirueckel c3b62ec
refactor: use sonner for feedback and error messages
aofn d161e55
Merge branch 'error-sonner' into explore
aofn 923a27c
chore: fix eslint error (import order)
andirueckel 3287d23
chore: disable eslint for useEffect
aofn 7fc4ba7
Merge remote-tracking branch 'origin/explore' into explore
aofn 1466fcb
refactor: use toast instead of error message
aofn c93d340
refactor: rename presets.js to matrixPresets.js and move to lib
aofn 99ff217
refactor: display error and success messages in toast when removing i…
aofn 9ef2609
refactor: remove unused variable
aofn 85b9dc5
chore: fix eslint errors
andirueckel e1599fc
refactor: show individual toasts for each invited user
aofn c8e1232
Merge branch 'error-sonner' into explore
aofn fc82ff6
fix: only add success message for actual successes
aofn 2e65e6e
Merge branch 'error-sonner' into explore
aofn 9214ad1
refactor: improve error message
aofn 0b82df1
Merge branch 'error-sonner' into explore
aofn 4a86a82
fix: variable name
aofn 0a19d5f
refactor: use ChatIframeView component in explore
aofn bb0d231
fix: accidentally deleted spacedeck view
aofn 64399bb
merge main into explore and adapt
aofn 8024f0e
refactor: add empty dependency array to useEffect to avoid unnecessar…
aofn a2196db
refactor: remove extra component to not rerender after changes inside…
aofn 546bb71
refactor: add custom styles and icons to sonner
aofn 245a296
Merge branch 'error-sonner' into explore
aofn baa179a
refactor: use shadecn Select in TemplateSelect.js
aofn ad39a47
merge main into explore
aofn 9c99e90
fix: catch error when trying to hydrate room content for private chat…
aofn 2ca4aae
refactor: add power level content overrider option to room creation a…
aofn 5148559
refactor: make sure iframe header is shown for chat rooms a user is n…
aofn f38d9e1
fix: iframe selector in chat iframe
aofn fe2fdc4
style: fixed width for icons in sonner/toast
andirueckel 513cba9
fix: call correct function when experiencing rate limits
aofn 5131654
Merge remote-tracking branch 'origin/error-sonner' into explore
aofn 4b6a867
style: improve vertical spacing
andirueckel 95ece2c
fix: iframe selector
aofn 11802cd
refactor: close menu on success
aofn 5b549e0
Merge branch 'write-workflow' into explore
aofn e4255f4
fix: iframe has differnet selector in prod and dev environment
aofn 487e096
merge main into explore
aofn 460f9c5
merge main into explore and adapt
aofn 3305365
feat: use shadcn Table for explore and adapt code base and replace em…
aofn c93ffe7
refactor: create separate cell for icons
aofn d8a7e70
chore: make eslint happy
aofn 52a4332
style: table colums widths and header icon style
andirueckel f24984c
refactor: remove unused column
aofn a2177a5
style: remove type-related classes from Table
andirueckel b3d964a
style: change border-bottom color of Table rows
andirueckel 4646019
style: apply background-color on hover to tbody tr
andirueckel 65d9e57
style: update/improve size templates in Button
andirueckel 2eb5415
style: adapt to our use-case and clean-up classes of Table
andirueckel f6dfa73
style: fix column widths in explore content Table
andirueckel afd4770
style: improve structure and styling of Table elements
andirueckel 6573d71
style: fix icon button width; Table needs implementation
andirueckel 9599bac
style: no bold in Table th element
andirueckel 66dca56
style: border-botton *and* -top for Table thead
andirueckel 5de8766
chore: use TableRow/Cell components in TableFooter
andirueckel dd83606
style: fix sticky thead and pagination section
andirueckel cd78f11
refactor: add lock next to password protected pads in explore
aofn 4b92c56
refactor: adapt table in side menu for code changes and display arrow…
aofn c604f42
draft: only display table and pagination if not empty
andirueckel 6f2e158
style: right-align active icon indicator arrow
andirueckel 819d8d8
fix: internal server error when adding links and display error messag…
aofn 32e7209
Remove dependencies as they're listed in devDependencies already
fnwbr 3ee245c
style: decrease size of password-protected indicator
andirueckel 781276b
chore: remove console.log
aofn 502e567
refactor: remove pagination
aofn 3e13144
style: sticky-bottom "Add more …" button
andirueckel 413225c
style: vertically grow context/item title cell if long
andirueckel 4a28a44
chore: block-comment instead per-line comment
andirueckel 4bcaade
refactor: use shadcn Breadcrumb component for navigation inside explo…
aofn 3ab0181
merge explore-data-table into explore-breadcrumbs
aofn 276403c
WIP: change layout
aofn 9d87528
Merge pull request #150 from medienhaus/explore-data-table
aofn 16b48c0
style: fix scrolling; scroll outer container, not inner
andirueckel fd28f18
chore: fix eslint errors
andirueckel acbb9ff
push Breadcrumb file
aofn 5ad10af
chore: improve pencil icon for item type etherpad
andirueckel b138b28
merge explore into explore-breadcrumb
aofn d135ab8
fix: truncate pad name for mypads to max 40 characters to avoid errors
aofn a370848
merge write-workflow into explore
aofn ee5f43b
Merge branch 'explore' into explore-breadcrumb
aofn f5f8dc4
style: fix vertical spacing in Drawer/DrawerDialog
andirueckel ca48a03
wip: inch closer to desired layout
aofn df8e7a5
fix: make sure links open in target blank
aofn 832a3a1
fix: creating context was broken due to code changes, working again
aofn 447becd
fix: error handling when not in room and not invited
aofn ea1e463
refactor: implement progress bar for explore instead of displaying lo…
aofn b21c8ae
draft: restructure header buttons
andirueckel d4875a7
style: refine progress bar styling
andirueckel d47d2d3
style: position progress bar very left
andirueckel f13c8bb
Merge pull request #153 from medienhaus/explore-progressbar
andirueckel b17bbaa
refactor: extract getSpaceChildren method into own hook
aofn 8619619
merge explore into space-children-hook and adapt to return progress
aofn 9d896a3
Merge pull request #155 from medienhaus/space-children-hook
aofn ac0711c
chore: remove unused code
aofn 295ccfb
refactor: move fetching state into hook and only display Add more but…
aofn 74f51fe
chore: rename state
andirueckel e7caf64
style: refine tabs list styling
andirueckel b432244
chore: formatting
andirueckel 1b6ed07
chore: remove comments and unused code
andirueckel 72d1c40
draft: use Tabs in header
andirueckel 0890787
merge explore into explore-restructure-header-buttons
aofn 9b59502
style: fix TabList inline flex positioning
andirueckel bcccfd4
draft: change tabs position (and code location)
andirueckel 424e696
chore: remove comments and unused code
andirueckel 547e1f4
fix: parse correct variables to createRoom
aofn 67304cd
style: refine avatar upload grid/sizing
andirueckel 3b9e812
chore: fix eslint error
andirueckel 9e256f2
draft: conditional content; introducing duplicate code
andirueckel 3f16657
style: fix scrolling via `overflow: auto;`
andirueckel 3ff980a
chore: remove comments and unused code
andirueckel c7558c6
chore: rename first tab in settings to general; add locales
andirueckel 0df129c
chore: format
andirueckel 6ddd15c
style: fix sticky header/footer on mobile
andirueckel 2234ccc
refactor: show members for all users, put settings tab behind condition
aofn 1458410
draft: try to fix/refine breadcrumb header
andirueckel 90fc724
refactor: adapt view when iframe is present and display correct heade…
aofn e75e3bf
refactor: move sidebar nav out of header and into ExploreIframeViews.js
aofn 65b29fb
fix: display room title if there is only one selected space and popul…
aofn fd86991
refactor: creating IframeSidebar.js component to display chat view co…
aofn f67187a
refactor: remove unused variable
aofn d2f407d
style: fix focus/hover color of a:link in dropdown
andirueckel 0871a92
chore: fix typo(?)
andirueckel d5addeb
refactor: only show chevron if there are multiple spaces in the array
aofn 3a19e8f
refactor: fix view for items
aofn 122b585
refactor: show breadcrumb navigation above items and add 'add more' icon
aofn aae5b7a
chore: remove space
andirueckel 620a4da
style: refine iframe header; nowrap and overflow
andirueckel 132df44
style: no muted foreground color in breadcrumb list
andirueckel f7bb492
style: make last breadcrumb item bold
andirueckel 238c9f7
chore: remove obsolete tailwind font class
andirueckel 864e4e9
style: wrap service iframe header title in h3
andirueckel 7e2aab5
revert: do not wrap title in h3
andirueckel 3d78c41
draft: we might need this after merge for overflow
andirueckel f6e13fc
style: fix focus color and no underline in dropdown
andirueckel 82396d9
style: change breadcrumb parent directory icon
andirueckel 4b6bbe1
style: change breadcrumb separator icon
andirueckel 72f0f09
Merge pull request #156 from medienhaus/explore-restructure-header-bu…
aofn 8563e2d
merge explore into explore-breadcrumb and adapt
aofn 263b6d7
Merge pull request #157 from medienhaus/explore-breadcrumb
aofn 046ee9b
refactor: simplify cell logic for icons
aofn b22d327
refactor: Extract the condition for rendering the settings tab and Qu…
aofn 73a565b
Merge branch 'explore-breadcrumb' into explore
aofn 69fcae2
feat: add shadecn Switch
aofn 2f95437
refactor: implement switch to grant users write rights. add condition…
aofn 3f5563b
merge main into explore
aofn ff74c4b
merge invite-promote into explore
aofn c6a8c79
refactor: improve error handling
aofn 0a9edc7
style: limit width of settings tabs content
andirueckel cfd7f3f
refactor: return await function when setting powerlevel
aofn fea1abd
style: do not flex-wrap breadcrumb line
andirueckel f1c8a08
chore: fix breadcrumb icon overflow; remove comments
andirueckel 490a05d
refactor: move useGetSpaceChildren.js hook into hooks directory
aofn 079e532
Merge remote-tracking branch 'origin/explore' into explore
aofn e3a64ca
fix: room name in hint when hovering over knock on space icon
aofn 9877b9b
chore: wrap invitations and knocks in div
andirueckel fcaf67f
chore: add some vertical spacing to dashboard
andirueckel a3468c0
chore: format via prettier
andirueckel 4f17de8
style: vertically align lock icon in explore table
andirueckel e649f30
draft: maybe fix avatar placeholder on ios safari
andirueckel 3bc9f1f
feat: add notification bubble icon to nav toggle
andirueckel 0458f23
chore: use new notification bubble approach in nav
andirueckel 3399474
chore: adapt new notification bubble style/sizing
andirueckel fb24102
chore: format via prettier
andirueckel e64a885
fix: close dropdown menu when content was loaded
aofn 308f9b0
chore: remove old comment
andirueckel 48ea80e
style: wrap service table in div for overflow-x
andirueckel 1959e98
style: sticky-bottom invite users button
andirueckel 44646d7
style: wrap favourites table in div for overflow-x
andirueckel 1c74c8b
refactor: ake sure QuickAddExplore is onky displayed after loading is…
aofn 1029915
chore: remove heading in members tab
andirueckel 083e2c7
draft: revert breaking ChatIframeView changes
andirueckel b64d902
draft: add separate ExploreChatView for /explore
andirueckel 01aa3cf
chore: remove obsolete comments
andirueckel 5284563
fix: display correct icons in context view
andirueckel 5d366e5
chore: comment now unused getIcon() function
andirueckel d7a6a36
fixing the root of the error: link was created with type context inst…
robertschnuell 8b8be3f
removing unused commented out code
robertschnuell 4a057a9
Merge pull request #161 from medienhaus/explore-fix-icons-in-context-…
robertschnuell 4e340df
style: fix sizing of icon button loading spinner
andirueckel 169af08
chore: format via prettier
andirueckel bd6cee1
chore: adjust canAddMoreContent to canManageSpace
andirueckel 8739f9b
fix: conditional loading spinner and progress bar
andirueckel 8e675ac
chore: format via prettier
andirueckel 65aeeea
chore: remove canManageSpace condition and const
andirueckel f9bfbf2
chore: format via prettier
andirueckel 6383554
chore: fix condition for members tab; fix locales
andirueckel e3b16ba
chore: add more missing locales
andirueckel 45d65af
Merge pull request #164 from medienhaus/explore-conditional-loading
robertschnuell 75ce702
fix: conditionally display table, else no-content notice
andirueckel 02f9ae3
adding default value and remove error
robertschnuell 2e2a882
chore: remove unused locale
andirueckel e430f3b
chore: return null instead of empty fragment
andirueckel 9dd04e7
Merge pull request #165 from medienhaus/explore-optional-template-wit…
andirueckel bd015c7
chore: fix eslint errors
andirueckel cfed0e3
style: fix sizing of icon button loading spinner
andirueckel 23bea27
update config.example.js with localStorage and templates object
andirueckel 309be36
local storage application version control
robertschnuell f4b7866
chore: try fixing the github eslint runner
andirueckel 07dfd45
chore: fix capitalisation in heading on /dashboard
andirueckel af7c7cd
chore: fix spacing between elements on /dashboard
andirueckel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,5 @@ yarn-error.log* | |
# vercel | ||
.vercel | ||
|
||
#vs code workspace files | ||
*.code-workspace |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
|
||
import React, { useCallback, useEffect, useState } from 'react'; | ||
import _ from 'lodash'; | ||
|
||
import { useAuth } from '../lib/Auth'; | ||
import { useMatrix } from '../lib/Matrix'; | ||
import LoadingSpinnerInline from './UI/LoadingSpinnerInline'; | ||
|
||
const CachedContextMultiLevelSelectSingleLevel = ({ parentSpaceRoomId, selectedContextRoomId, onSelect, onFetchedChildren, templatePlaceholderMapping, templatePrefixFilter, sortAlphabetically, showTopics }) => { | ||
const auth = useAuth(); | ||
const matrixClient = auth.getAuthenticationProvider('matrix').getMatrixClient(); | ||
const matrix = useMatrix(auth.getAuthenticationProvider('matrix')); | ||
const [isLoading, setIsLoading] = useState(true); | ||
const [parentSpaceMetaEvent, setParentSpaceMetaEvent] = useState(); | ||
const [childContexts, setChildContexts] = useState(); | ||
|
||
useEffect(() => { | ||
let isSubscribed = true; | ||
|
||
// Fetch all child contexts from our storage | ||
const fetchChildContexts = async () => { | ||
let newChildContexts = []; | ||
const spaceCache = await matrix.spaces.get(parentSpaceRoomId) || await matrix.rooms.get(parentSpaceRoomId); | ||
if (!spaceCache) return; | ||
setParentSpaceMetaEvent(spaceCache.meta); | ||
for (const room of spaceCache.children) { | ||
const roomObject = matrix.spaces.get(room) || matrix.rooms.get(room); | ||
// // If this is not a context, ignore this space child | ||
// if (metaEvent && metaEvent.type !== 'context') continue; | ||
// // If we only want to show specific contexts, ignore this space child if its template doesn't have the given prefix | ||
if (templatePrefixFilter && roomObject.meta && !_.startsWith(roomObject.meta.template, templatePrefixFilter)) continue; | ||
// // ... otherwise show this space child: | ||
newChildContexts.push(roomObject); | ||
} | ||
if (sortAlphabetically) { | ||
newChildContexts = _.sortBy(newChildContexts, 'name'); | ||
} | ||
if (!isSubscribed) return; | ||
onFetchedChildren(newChildContexts.length > 0); | ||
setChildContexts(newChildContexts); | ||
}; | ||
|
||
const fetch = async () => { | ||
setIsLoading(true); | ||
await fetchChildContexts(); | ||
setIsLoading(false); | ||
}; | ||
|
||
fetch(); | ||
|
||
return () => { | ||
isSubscribed = false; | ||
}; | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [matrixClient, parentSpaceRoomId, sortAlphabetically, templatePlaceholderMapping, templatePrefixFilter]); | ||
|
||
if (isLoading) { | ||
return <select key="loading" disabled><option><LoadingSpinnerInline /></option></select>; | ||
} | ||
|
||
if (!childContexts || childContexts.length < 1) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<select | ||
value={selectedContextRoomId} | ||
onChange={(e) => { | ||
onSelect(parentSpaceRoomId, e.target.value); | ||
}} | ||
> | ||
{ | ||
(templatePlaceholderMapping && parentSpaceMetaEvent && templatePlaceholderMapping[parentSpaceMetaEvent.template] | ||
// If we have a template-specific placeholder, show that... | ||
? <option disabled value="">{ templatePlaceholderMapping[parentSpaceMetaEvent.template] }</option> | ||
// ... otherwise just show an empty placeholder | ||
: <option disabled value="">-- select --</option> | ||
) | ||
} | ||
{ Object.entries(childContexts).map(([key, room]) => { | ||
// if room is undefined we jumop to the next one | ||
// this can happen when for example a room was not removed as a space child from its parent but is already deleted | ||
if (!room) return; | ||
|
||
return <option key={key} value={room.roomId}> | ||
{ room.name } | ||
{ showTopics && room.topic && (` (${room.topic})`) } | ||
</option>; | ||
}) } | ||
</select> | ||
); | ||
}; | ||
|
||
/** | ||
* This component renders a multi-level <select> UI for an arbitrary set of contexts in the sense of Matrix spaces. | ||
* `activeContexts` is the array of room IDs for the currently set context spaces. | ||
* | ||
* @param {Array} activeContexts | ||
* @param {function} onChange (newActiveContexts, isLeaf) | ||
* @param {boolean} showTopics - If the contents of m.room.topic should be displayed in parentheses next to the name | ||
* @param {boolean} sortAlphabetically - If entries should be ordered alphabetically | ||
* @param {Object} templatePlaceholderMapping - Optional object containing placeholders for each <select> based on the `dev.medienhaus.meta.template` of the parent context | ||
* @param {string} templatePrefixFilter - Optional prefix to filter contexts by their templates | ||
* | ||
* @return {React.ReactElement} | ||
*/ | ||
const CachedContextMultiLevelSelect = ({ activeContexts, onChange, showTopics, sortAlphabetically, templatePlaceholderMapping, templatePrefixFilter }) => { | ||
const onSelect = useCallback((parentContextRoomId, selectedChildContextRoomId) => { | ||
const newActiveContexts = [...activeContexts.splice(0, activeContexts.findIndex((contextRoomId) => contextRoomId === parentContextRoomId) + 1)]; | ||
if (selectedChildContextRoomId) newActiveContexts.push(selectedChildContextRoomId); | ||
onChange(newActiveContexts, undefined); | ||
}, [activeContexts, onChange]); | ||
|
||
const onFinishedFetchingChildren = useCallback((hasChildren) => { | ||
if (onChange.length > 1) { | ||
onChange(activeContexts, !hasChildren); | ||
} | ||
}, [activeContexts, onChange]); | ||
|
||
return ( | ||
<> | ||
{ activeContexts && activeContexts.map((contextRoomId, i) => ( | ||
<CachedContextMultiLevelSelectSingleLevel | ||
key={contextRoomId} | ||
onSelect={onSelect} | ||
onFetchedChildren={onFinishedFetchingChildren} | ||
parentSpaceRoomId={contextRoomId} | ||
selectedContextRoomId={activeContexts[i + 1] ?? ''} | ||
showTopics={showTopics} | ||
sortAlphabetically={sortAlphabetically} | ||
templatePlaceholderMapping={templatePlaceholderMapping} | ||
templatePrefixFilter={templatePrefixFilter} | ||
/> | ||
)) } | ||
</> | ||
); | ||
}; | ||
|
||
export default CachedContextMultiLevelSelect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import styled from 'styled-components'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
|
||
const PreviousNextButtonsWrapper = styled.div` | ||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
grid-gap: var(--margin); | ||
|
||
&:not(:first-child) { | ||
margin-top: var(--margin); | ||
} | ||
`; | ||
|
||
const NextButton = styled.button` | ||
|
||
color: var(--color-background); | ||
background-color: ${props => props.warning ? 'var(--color-notification)' :'var(--color-foreground)'}; | ||
border-color: ${props => props.warning && 'var(--color-notification)'}; | ||
|
||
&:disabled { | ||
color: var(--color-background); | ||
background-color: var(--color-disabled); | ||
} | ||
`; | ||
|
||
const PreviousButton = styled.button` | ||
|
||
color: var(--color-foreground); | ||
background-color: var(--color-background); | ||
|
||
&:disabled { | ||
color: var(--color-disabled); | ||
background-color: var(--color-background); | ||
} | ||
`; | ||
|
||
/** | ||
* React Component which returns | ||
* | ||
* @param {Boolean} disabled disables both buttons if true | ||
* @param {function} onClick onClick function to execute when clicking 'next' | ||
* @param {function} onCancel function to execute when clicking 'previous' | ||
* @param {Boolean} disableNext disables 'next' button if true | ||
* @param {Boolean} disablePrev disables 'previous' button if true | ||
* @returns {React.JSX} two inline buttons. 'previous' and 'next' | ||
*/ | ||
const PreviousNextButtons = ({ children, disabled, onCancel, disableNext, disablePrev, warning }) => { | ||
const { t } = useTranslation(); | ||
|
||
const handlePrevious = (e) => { | ||
//@TODO check type submit thing | ||
e.preventDefault(); | ||
onCancel(); | ||
}; | ||
|
||
return ( | ||
<PreviousNextButtonsWrapper> | ||
<PreviousButton type="button" disabled={disabled || disablePrev} onClick={handlePrevious}>{ t('Previous') }</PreviousButton> | ||
<NextButton type="submit" disabled={disabled || disableNext} warning={warning}> { children || t('Next') }</NextButton> | ||
</PreviousNextButtonsWrapper> | ||
); | ||
}; | ||
|
||
export default PreviousNextButtons; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import styled from 'styled-components'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import IframeLayout from '../../components/layouts/iframe'; | ||
import BinIcon from '../../assets/icons/bin.svg'; | ||
import CopyToClipboard from '../../components/UI/CopyToClipboard'; | ||
import LoadingSpinnerInline from '../../components/UI/LoadingSpinnerInline'; | ||
import FolderIcon from '../../assets/icons/folder.svg'; | ||
import ListSettingsIcon from '../../assets/icons/list-settings.svg'; | ||
import InviteUsersToMatrixRoom from './InviteUsersToMatrixRoom'; | ||
|
||
const ToggleButton = styled.button` | ||
/* unset globally defined button styles; set height to line-height */ | ||
width: unset; | ||
height: calc(var(--margin) * 1.3); | ||
padding: unset; | ||
background-color: unset; | ||
border: unset; | ||
`; | ||
|
||
const ServiceIframeHeader = ({ isDeletingPad, deleteContent, title, roomId, mypadsPadObject, content, myPowerLevel, setManageContextActionToggle, manageContextActionToggle }) => { | ||
const { t } = useTranslation('write'); | ||
|
||
return ( | ||
<IframeLayout.IframeHeader> | ||
<h2>{ title }</h2> | ||
<IframeLayout.IframeHeaderButtonWrapper> | ||
<CopyToClipboard content={content} /> | ||
{ deleteContent && <button title={t(mypadsPadObject ? 'Delete pad' : 'Remove pad from my library')} onClick={deleteContent}> | ||
{ isDeletingPad ? <LoadingSpinnerInline /> : <BinIcon fill="var(--color-foreground)" /> } | ||
</button> } | ||
<InviteUsersToMatrixRoom roomId={roomId} name={title} /> | ||
{ myPowerLevel && ( | ||
manageContextActionToggle ? ( | ||
<ToggleButton onClick={() => { setManageContextActionToggle(false); }}> | ||
<FolderIcon | ||
title={t('Browse the selected context')} | ||
fill="var(--color-foreground)" | ||
/> | ||
</ToggleButton> | ||
) : ( | ||
<ToggleButton onClick={() => { setManageContextActionToggle(true); }}> | ||
<ListSettingsIcon | ||
title={t('Manage the selected context')} | ||
fill="var(--color-foreground)" | ||
/> | ||
</ToggleButton> | ||
|
||
) | ||
) } | ||
</IframeLayout.IframeHeaderButtonWrapper> | ||
</IframeLayout.IframeHeader> | ||
); | ||
}; | ||
export default ServiceIframeHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / ESLint
verifies the list of dependencies for Hooks like useEffect and similar Error