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

[WIP] Zeitline component #3631

Closed
wants to merge 4 commits into from
Closed

Conversation

Aluriak
Copy link

@Aluriak Aluriak commented Aug 28, 2024

Following #3620 , i tried something. Does not work (got an empty page), which is visible through the test.

I don't know anything about vue.js, so i guess my zeitline.js file has several problems.

Can someone help me ?

@rodja rodja added the help wanted Extra attention is needed label Aug 29, 2024
@rodja
Copy link
Member

rodja commented Aug 29, 2024

We do not have the time, but maybe someone from the community can jump in?

}),
},
async mounted() {
this.line = new Zeitline.Timeline(this.conf);
Copy link
Contributor

Choose a reason for hiding this comment

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

seems like you're not importing the zeitline.min.bundle.js anywhere so i'd assume this is undefined?

Copy link
Author

@Aluriak Aluriak Aug 31, 2024

Choose a reason for hiding this comment

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

Isn't the resource already added with self.add_resource(Path(__file__).parent / 'lib' / 'zeitline') ?

I tried anyway, but the problem remains the same ; i got a Uncaught SyntaxError: unexpected token: identifier for the line async mounted() { in the javascript console log.

I will look into that and get back to you

Thank you :)

Copy link
Contributor

@falkoschindler falkoschindler Aug 31, 2024

Choose a reason for hiding this comment

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

The syntax error is caused by a missing } in the data() definition above.

Regarding the resource: You also have to load it on the client side. See the fullcalendar example for a very similar case:

await loadResource(window.path_prefix + `${this.resource_path}/index.global.min.js`);

Copy link
Author

Choose a reason for hiding this comment

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

Okay, it was the syntax problem and the missing imports. I copied from codemirror.js and now i've got a problem : the zeitline.bundle.min.js import is failing because of an undefined statement.

The source code of zeitline starts with : (deminimization and debugging with firefox)

!function (t, n) {
  'object' == typeof exports &&
  'object' == typeof module ? module.exports = n() : 'function' == typeof define &&
  define.amd ? define([], n) : 'object' == typeof exports ? exports.Zeitline = n() : t.Zeitline = n()
}(

And the TypeError: t is undefined is raised at the 4th line, so i guess somehow n() : t.Zeitline = n() does not know about the function parameter t. Looks magic to me, but i guess either it's because my zeitline.bundle.min.js is malformed, either i'm using it wrong.

Copy link
Author

@Aluriak Aluriak Aug 31, 2024

Choose a reason for hiding this comment

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

The syntax error is caused by a missing } in the data() definition above.

Regarding the resource: You also have to load it on the client side. See the fullcalendar example for a very similar case:

await loadResource(window.path_prefix + `${this.resource_path}/index.global.min.js`);

Hi ! Thank you very much for looking into that !

Yeah, i just found that too :)

However, i copied the client-side import from codemirror.js. Can you verify it's valid too ?

@xaptronic
Copy link
Contributor

xaptronic commented Oct 24, 2024

Zeitline needs an svg element to render into:

image

Would it make more sense to do this as a 3p extension?

(this component seems kind of old, and has many old deps in it's code)

@falkoschindler
Copy link
Contributor

falkoschindler commented Oct 25, 2024

@xaptronic You mean moving ui.zeitline into a separate repo/package? Sure, this might be reasonable.

@xaptronic
Copy link
Contributor

WIP here: https://github.com/xaptronic/nicegui-zeitline

I am going to try and get event handlers working before pushing to pypi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants