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

feat: change workspace names to icons #1240

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

orgrimarr
Copy link

Pre-flight Checklist

Please ensure you've completed all of the following.

Description of Change

  • I reduced the size of the workspaceDrawer
  • I replaced the workspaceItem text with an icon or the first letter. as a fallback
  • I added in the workspace config a icon field in the form

The icon field is not persisted, I dit not manage to do it.
The icon config could be more user-friendly than a simple text input

Motivation and Context

This PR is a proposal regarding this issue #139

Screenshots

image image image

Checklist

  • My pull request is properly named
  • [x]The changes respect the code style of the project (pnpm prepare-code)
  • pnpm test passes
  • I tested/previewed my changes locally

Release Notes

@vraravam
Copy link
Contributor

@orgrimarr - is there a reason for this to be in "Draft" mode still?

Copy link
Contributor

@vraravam vraravam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great initiative! Please continue with this, I will close my draft PR

src/components/ui/WorkspaceIcon.tsx Outdated Show resolved Hide resolved
src/features/workspaces/components/WorkspaceDrawer.tsx Outdated Show resolved Hide resolved
src/themes/default/index.ts Outdated Show resolved Hide resolved
@vraravam
Copy link
Contributor

  1. Please create your branch from the latest version of the upstream's main/master (in this case develop) branch
  2. When contributing to OSS, please check if other PRs are open for the same feature by someone else. Maybe if one exists, then you can collaborate in the same PR as opposed to creating a competing implementation.

@orgrimarr
Copy link
Author

  • Please create your branch from the latest version of the upstream's main/master (in this case develop) branch
  • When contributing to OSS, please check if other PRs are open for the same feature by someone else. Maybe if one exists, then you can collaborate in the same PR as opposed to creating a competing implementation.

Hi,

Thanks for your fast review, 😀

The goal was not to create a competing implementation, I just thought is was an easy way to share code.
That why this PR is still in draft mode.

Sorry for that 😕

@orgrimarr
Copy link
Author

Some questions 😀 :

In order allow both visual, should I add an option in the sidebar setting like "Use workspace drawer icon style" ?
In the text mode, should we display an icon ? or only if configured ? or not ?, if yes then the setting might be "Hide workspace drawer text"

How can I persist theses settings ? (icon path, drawer visual) ?
I din't understand what should I do in the code

I'm only using Ferdium without an account. I wonder how to sync the icon setting. Because if we use a local path, the image might not exist in another host, and the OS path system might be different. Should we store the image content ? (We can ask for a specific image format and size like Rambox to reduce the size to a acceptable one)

@vraravam
Copy link
Contributor

vraravam commented Jun 16, 2023

In order allow both visual, should I add an option in the sidebar setting like "Use workspace drawer icon style" ? In the text mode, should we display an icon ? or only if configured ? or not ?, if yes then the setting might be "Hide workspace drawer text"

Add this user preference in the workspace preference screen. I would also move the icon text box outside of the "create" action, and into the screen where the services are associated with a workspace.

How can I persist theses settings ? (icon path, drawer visual) ? I din't understand what should I do in the code
I'm only using Ferdium without an account. I wonder how to sync the icon setting. Because if we use a local path, the image might not exist in another host, and the OS path system might be different. Should we store the image content ? (We can ask for a specific image format and size like Rambox to reduce the size to a acceptable one)

The service and similarly the workspace preferences are ultimately stored in a sqlite db - whether its using the "accountless" option (which is basically running a local server), or the hosted server solution. The internal servers' code changes are in the same repo, but the hosted server is in a sibling repo called ferdium-server. I can help review/point you to the code file where the DML needs to be changed to add a new column in that corresponding table.

@orgrimarr
Copy link
Author

Thanks :)

I will add a button in the user preference  😀

I would also move the icon text box outside of the "create" action, and into the screen where the services are associated with a workspace.

What do you mean by 'move the icon text box outside of the "create" action' ?
Should I remove the icon input in the create view like this ?
So the icon can only be edited where the services are associated with a workspace

image

I can help review/point you to the code file where the DML needs to be changed to add a new column in that corresponding table.

Yes please, can you help me on that point ? Which file should I modify to add

  • The new icon property on the Workspace data
  • The new user setting property to toggle the icon view

@orgrimarr orgrimarr marked this pull request as ready for review June 17, 2023 13:41
@orgrimarr orgrimarr requested a review from a team as a code owner June 17, 2023 13:42
@orgrimarr
Copy link
Author

It should work as discussed.

Just missing the workspace iconUrl persistance.
The user setting seams to be automagically persisted 😀

@@ -53,12 +53,21 @@ const styles = (theme: { workspaces: { drawer: { width: any } } }) => ({
// width: `calc(100% + ${theme.workspaces.drawer.width}px)`,
width: '100%',
transition,
},
appContentTransformTextWorkspace: {
transform() {
return workspaceStore.isWorkspaceDrawerOpen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to move the ternary to be evaluated inside the translateX() like so?

return 'translateX(`workspaceStore.isWorkspaceDrawerOpen ? 0 : -75px`)');

(Syntax might be incorrect since I'm not typing inside an editor)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we can do that

transform() {
return workspaceStore.isWorkspaceDrawerOpen
? 'translateX(0)'
: `translateX(-${theme.workspaces.drawer.width}px)`;
},
},
appContentTransformIconWorkspace: {
transform() {
return workspaceStore.isWorkspaceDrawerOpen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that it is more readable.
If it's ok for you, I can push that change

  appContentTransformTextWorkspace: {
    transform() {
      return `translateX(${
        workspaceStore.isWorkspaceDrawerOpen
          ? '0'
          : `-${theme.workspaces.drawer.width}px`
      })`;
    },
  },
  appContentTransformIconWorkspace: {
    transform() {
      return `translateX(${
        workspaceStore.isWorkspaceDrawerOpen ? '0' : `-75px`
      })`;
    },
  },

@@ -259,6 +259,10 @@ const messages = defineMessages({
id: 'settings.app.form.alwaysShowWorkspaces',
defaultMessage: 'Always show workspace drawer',
},
useWorkspaceDrawerIconStyle: {
id: 'settings.app.form.useWorkspaceDrawerIconStyle',
defaultMessage: 'Use workspace drawer icon style',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I was suggesting to have the user choose whether they want the name or the first character of the workspace name AND/OR the icon. Could the feature be imagined like that?

Copy link
Author

@orgrimarr orgrimarr Jun 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly.

The letter is currently a fallback for workspaces that don't have an icon.

The setting should be a select with theses choices :

  • text (current display)
  • (letter OR icon) AND text
  • letter AND icon (if icon configured)
  • letter OR icon (current PR)

It means, 3 different workspace drawer sizes

  • the current (300px by default)
  • icon OR letter only (35 - 75px)
  • letter + icon (let's say 75 - 150px)

Copy link
Author

@orgrimarr orgrimarr Jun 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the workspace drawer bar be the same size of the service bar ?
I means use the serviceRibbonWidth parameter for both workspace and service bar (only when displaying icon)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vraravam Can you confirm that I have understood correctly ?
If yes, I will start the dev this week   😀

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to complicate so much. only 2 options that i was suggesting:

  1. workspace name (current)
  2. icon or first character of workspace name (if the user wants to use a smaller-width option for the workspace drawer)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To permanently save this field you would probably need to sync with the server (internal and external) if I'm correct.

I'm not recalling if the server is saving workspace data as a plain JSON or not (only by checking the endpoint we can be sure of that). If that is not the case, you would need to touch both the server and the internal-server... but with the ongoing Adonis update this could be a hassle :/ I can help on that tho.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, can we make this option the default one? I like this new look (even though I'm not using workspaces).

Great work!!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you will need to sync to the internal and external servers. The db schema is the same across both - and there's a table called workspaces to store this info.
Screenshot 2023-09-05 at 8 18 24 AM

As seen in the above pic (taken from my internal server), you can either add a new column for the useIcon or you can add it into the data column which holds JSONB datatype. (I personally prefer option 1.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you will need to sync to the internal and external servers. The db schema is the same across both - and there's a table called workspaces to store this info. Screenshot 2023-09-05 at 8 18 24 AM

As seen in the above pic (taken from my internal server), you can either add a new column for the useIcon or you can add it into the data column which holds JSONB datatype. (I personally prefer option 1.

Even though I would prefer option 1 (just like you) I would advise into adding it to "data" column (but first lets be sure what type of data is being retrieved there) so that it doesn't make the migration to the new Adonis's even more complicated (as we would to update both the code in the current ferdium-server, internal server and on the current adonis update PR)

Copy link
Author

@orgrimarr orgrimarr Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As suggested, i added the iconUrl field in data

WIP related PR on the server : ferdium/ferdium-server#102

src/i18n/locales/fr.json Outdated Show resolved Hide resolved
@SpecialAro
Copy link
Member

SpecialAro commented Sep 5, 2023

Hi @orgrimarr I've been testing your code and it seems that it breaks functionality if you use an horizontal bar and not a vertical one. Can you please fix that?

Also, I've take a look at how we update workspaces and, indeed, we are going to need to touch both the internal server and Ferdium server after all (no escape from that). So there is that... I can help you with that tho!

@orgrimarr
Copy link
Author

Thanks you both for your comments !
I will fix this bug and will modify the server 😃

orgrimarr added a commit to orgrimarr/ferdium-app that referenced this pull request Sep 14, 2023
orgrimarr added a commit to orgrimarr/ferdium-server that referenced this pull request Sep 14, 2023
vraravam pushed a commit to orgrimarr/ferdium-app that referenced this pull request Feb 10, 2024
vraravam pushed a commit to orgrimarr/ferdium-app that referenced this pull request Feb 11, 2024
@vraravam
Copy link
Contributor

@orgrimarr - is this PR mergeable at least for the internal server bits which live in this codebase itself? Can you please help to take this to completion?

@vraravam vraravam added the question ❓ Further information is requested label Feb 11, 2024
@orgrimarr
Copy link
Author

Hi,
Yes, I think it is.
I will do a quick check this week

@orgrimarr
Copy link
Author

@vraravam I check the code quickly, looks good for me.
Behaviors sounds good, test (different size of sidebar in combination with horizontal / vertical style.

I notice that we can also use icon url, wich can be easier to configure than local file.

Should be mergeable.

@SpecialAro
Copy link
Member

@vraravam I think we should also build the logic for the ferdium server part, otherwise this feature won't work (and probably will break) for users using Ferdium server

@vraravam
Copy link
Contributor

Thanks for the confirmation @orgrimarr

@SpecialAro - we currently support 4 server backends:

  1. Franz
  2. Ferdi
  3. Ferdium (hosted)
  4. no server

This change is going to break for the first 2 anyways. The 3rd one, while under our control, still has a ways to go. With this being the case, how shall we proceed?

@vraravam
Copy link
Contributor

I notice that we can also use icon url

yes - I would prefer this option as opposed to uploading an icon. For the rare cases where folks create and use custom icons, they can self-host in some website, and provide that url. In most cases though, icons are usually available on the net and so a url is easier for us to keep track of/maintain that a binary file. This will also reduce the burden on syncing between the different server backends.

@orgrimarr - could you please make such a change within this same PR?

vraravam pushed a commit to orgrimarr/ferdium-app that referenced this pull request Feb 13, 2024
@orgrimarr
Copy link
Author

I notice that we can also use icon url

yes - I would prefer this option as opposed to uploading an icon. For the rare cases where folks create and use custom icons, they can self-host in some website, and provide that url. In most cases though, icons are usually available on the net and so a url is easier for us to keep track of/maintain that a binary file. This will also reduce the burden on syncing between the different server backends.

@orgrimarr - could you please make such a change within this same PR?

@vraravam I think no changes are required.

Currently, we can only configure strings https://github.com/ferdium/ferdium-app/pull/1240/files#diff-e8933cda65f8319a0a3982de972254fd0ef8f96dac31e0530660e5608682ef3bR10

  • url
  • local file path

This property is used to configure the image src https://github.com/ferdium/ferdium-app/pull/1240/files#diff-46ab6517cb2faf44c8255f0b1a0955a5b534eaa2786fc1f1fbbe97e85d16942cR51

@SpecialAro
Copy link
Member

Thanks for the confirmation @orgrimarr

@SpecialAro - we currently support 4 server backends:

  1. Franz
  2. Ferdi
  3. Ferdium (hosted)
  4. no server

This change is going to break for the first 2 anyways. The 3rd one, while under our control, still has a ways to go. With this being the case, how shall we proceed?

The first two (I think the 2nd one we are not supporting anymore) are going to break regardless - and users are aware of this (a message pops-up when they change to the first two. But, given that we are referring to the same project (Ferdium) I have the opinion that we should make this feature work across our entire ecosystem (account and accountless).

In fact, if this works for the internal server (which still lacks the adonis update) then it should work for ferdium server, given that the implementation is rather similar (almost copy paste on the code).

@orgrimarr
Copy link
Author

@vraravam @SpecialAro Regarding the url persistance within the Workspace table.

Now that the adonis migration is done, should i keep saving the url in the data column ? or create a new one ?

I can try to modify ferdium-server this week

@vraravam
Copy link
Contributor

Now that the adonis migration is done, should i keep saving the url in the data column ? or create a new one ?

Keeping the same schema will hopefully keep us backward compatible with all the currently-supported servers (franz, ferdi, ferdium hosted, no-server). So I would not change that db schema at this point.

@vraravam
Copy link
Contributor

Currently, we can only configure strings https://github.com/ferdium/ferdium-app/pull/1240/files#diff-e8933cda65f8319a0a3982de972254fd0ef8f96dac31e0530660e5608682ef3bR10

yes, the datatype in the codebase is a string - but, at the UI level, I think its expects a file to be dragged and dropped. How will the end user experience be if they want or are forced to use a url?

@orgrimarr
Copy link
Author

orgrimarr commented Feb 14, 2024

Currently, we can only configure strings https://github.com/ferdium/ferdium-app/pull/1240/files#diff-e8933cda65f8319a0a3982de972254fd0ef8f96dac31e0530660e5608682ef3bR10

yes, the datatype in the codebase is a string - but, at the UI level, I think its expects a file to be dragged and dropped. How will the end user experience be if they want or are forced to use a url?

At the UI level it look like this
image

Maybe i can iprove the placeholder with something like "Icon url" or "Icon url or local path"

@vraravam
Copy link
Contributor

yes, a more explicit text would be very much appreciated. Sorry, I was confusing with the service icon, then realized you are referring to the workspace icon.

SpecialAro pushed a commit to orgrimarr/ferdium-server that referenced this pull request Feb 15, 2024
vraravam pushed a commit to orgrimarr/ferdium-server that referenced this pull request Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question ❓ Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants